Answers for "fun fun function closures"

4

javascript closure function example

function makeFunc() {
  var name = 'Mozilla';
  function displayName() {
    alert(name);
  }
  return displayName;
}

var myFunc = makeFunc();
myFunc();
Posted by: Guest on July-04-2020
0

A closure Function

var returns_a_func = function () {
  var word = 'I can see inside '     function sentence(){    var word2 = 'I can also see outside. '     console.log(word + 'and ' + word2)   }   return sentence;
}var finalSentence = returns_a_func()finalSentence()
Posted by: Guest on June-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language