Javascript Function Closure Create

Description

Javascript Function Closure Create


// A simple example of a closure
function greetMe(name) {
  return function(greeting) {
    return greeting + " " + name;
  }//w  w  w.  j  a  v  a 2s  .c o m
}
let greetAlexei = greetMe("Alexei");
console.log( greetAlexei("Hello") ); 



PreviousNext

Related