Answers for "closure math"

1

closure example

const add = (function () {
  let counter = 0;
  return function () {counter += 1; return counter}
})();

add();
add();
add();

// the counter is now 3
Posted by: Guest on January-31-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language