Skip to content

Instantly share code, notes, and snippets.

@haingdc
Created March 13, 2018 04:43
Show Gist options
  • Save haingdc/5feba6692e0f3a8b50c8aeb049ca8565 to your computer and use it in GitHub Desktop.
Save haingdc/5feba6692e0f3a8b50c8aeb049ca8565 to your computer and use it in GitHub Desktop.
A Gentle Introduction to Functional JavaScript: Part 3
var thing = 'bat';
var sing = function() {
// Bên trong ‘sing’ có thể thấy biến line
var line = 'Twinkle, twinkle, little ' + thing;
console.log(line);
};
sing();
// Twinkle, twinkle, little bat
// Bên ngoài ‘sing’, chúng ta không thể thấy biến line
console.log(line);
// ⛔ Uncaught ReferenceError: line is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment