I want to create callback function with some parameters, but I want that one of the values within never change and be set when the function is created!
P.e.
let a = 2;
let y = (b) => { let staticValue = a; return staticValue * b; }
y(1) => 2 -> OK
then
a = 3
y(1) => 3 -> Not OK -> I want the function to have the original value of a.
I know, this happens because the variable a is only evaluated when the function is called. But is there any workaround?
localStorageand all that mess - but why bother? Just hard code the value into the function