Rajanikant Hawaldar
How do JavaScript closures work?

How do JavaScript closures work?

By Rajanikant Hawaldar in JavaScript on Oct 10 2020
  • Pranam Bhat
    May, 2021 21

    Closures are hard to explain because they are used to make some behaviour work that everybody intuitively expects to work anyway. I find the best way to explain them (and the way that I learned what they do) is to imagine the situation without them:const makePlus = function(x) {return function(y) { return x y; }; }const plus5 = makePlus(5); console.log(plus5(3));

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS