I’m trying to use closures but I can not get the value of the inner
closure I thought I understood closures when it came to strings working with values is different. I get the output for result and final from the console but I only get the return value from result
what am I doing wrong. Can someone explain this to me or point me in the right direction. I would greatly appreciate I can’t figure out what I am doing wrong
Code snippet:
function solution(param1, param2) {
var param1 = 1;
var param2 = 2;
var result = param1 + param2;
//anotherOne
/* wether I use this on or the call farther down
still get same results, I get two console out puts
3 and 1000 when I only want 1000 for the return
value*/
function anotherOne(param1, param2){
var param1 = 0;
var param2 = 1000;
var final = param1 + param2;
console.log(result);
console.log(final)
return final
}
anotherOne()
return result;
}
solution();
8