Skip to content

Instantly share code, notes, and snippets.

@haingdc
Created March 13, 2018 04:45
Show Gist options
  • Save haingdc/1b39fde6ce976a2f219365c34daa5f11 to your computer and use it in GitHub Desktop.
Save haingdc/1b39fde6ce976a2f219365c34daa5f11 to your computer and use it in GitHub Desktop.
A Gentle Introduction to Functional JavaScript: Part 3
var outer = function() {
var outerVar = 'Hatter';
var inner = function() {
// Hàm trong ‘inner’ có thể thấy biến outerVar
console.log(outerVar);
// Hatter
var innerVar = 'Dormouse';
// 🌳🌳🦍🌄 phạm vi của innerVar là trong hàm inner, bên ngoài không thể thấy
}
// 🙈 a! innerVar đi đâu rồi nhỉ?
return inner;
}
var f = outer();
f();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment