Answer the question
In order to leave comments, you need to log in
How can I optimize/reduce the code?
The code returns the actual value of the "y" variable, which is updated on scroll and writes the value to "f".
let f = (function () {
let y = (function () {
let result = 1;
return function () {
return result ++;
};
})();
$(window).on("scroll", function() {
return f = y();
});
})();
Answer the question
In order to leave comments, you need to log in
Thank you, I remembered the useless let.
And why all this?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question