This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
// ... | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// các câu lệnh | |
} | |
tên_nhãn: { | |
// các câu lệnh | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = 2; | |
(function foo(){ | |
var a = 3; | |
console.log( a ); // 3 | |
})(); | |
console.log( a ); // 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var person = "Alice"; | |
var fruit = "apple"; | |
var fruits = [ | |
"banana", | |
"lemon", | |
"mango", | |
"peace" | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var person = "Alice"; | |
var fruit = "apple"; | |
var fruits = [ | |
"banana", | |
"lemon", | |
"mango", | |
"peace" | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = []; | |
for (var year = 0; year < 5; year++) { | |
result.push(function () { return year }); // (1) | |
} | |
console.log(result[1]()); // 5 (không phải 1) | |
console.log(result[3]()); // 5 (không phải 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = []; | |
for(var year = 0; year < 5; year++) { | |
var y = year; // (2) | |
result.push(function() { return y; }); // (3) | |
} | |
console.log(result[1]()); // 4 (không phải 1) | |
console.log(result[3]()); // 4 (không phải 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var result = []; | |
for(var year = 0; year < 5; year++) { | |
(function() { | |
var y = year; | |
result.push(function() { return y; }); | |
})(); | |
} | |
console.log(result[1]()); // 1 | |
console.log(result[3]()); // 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myContainer = “Hey everybody! Come see how good I look!”; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function log(someVariable) { | |
console.log(someVariable); | |
return someVariable; | |
} |
OlderNewer