dimanche 3 mai 2015

Higher order javascript functions

can someone explain to me what is going on in the following code. The function is receiving n as parameter, so where is the m coming from? The whole code is confusing.. if someone can explain?

  function greaterThan(n) {
  return function(m) { return m > n; };
  }
   var greaterThan10 = greaterThan(10);
   console.log(greaterThan10(11));
   // → true

Aucun commentaire:

Enregistrer un commentaire