I am trying to understand closures in Javascript. I came across this example :
var add = (function () { var counter = 0; return function () {counter += 1;