Skip to content

Instantly share code, notes, and snippets.

@malavv
Last active December 13, 2015 18:38
Show Gist options
  • Save malavv/4956399 to your computer and use it in GitHub Desktop.
Save malavv/4956399 to your computer and use it in GitHub Desktop.
Blog_#3_Closure_Ex_Js
// JavaScript
var CompareWith = function(comparator) {
return function(elem) { return comparator == elem; };
}
var compareWith3 = CompareWith(3);
console.log(compareWith3(3) + " " + compareWith3(4));
// Prints - true false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment