Created
May 26, 2017 08:27
-
-
Save sophistifunk/d512117c5eb1a9eca3fa8ae88a35431c to your computer and use it in GitHub Desktop.
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
let arr = [10, 11, 12, 13]; | |
console.log(arr.length); // 4 | |
arr.foo = "bar"; | |
console.log(arr.length); // 4 | |
console.log(1 in arr); // true | |
console.log(arr[10] === undefined); // true | |
console.log(10 in arr); // false | |
arr[12] = "thirteenth value"; | |
console.log(arr.length); // 13 | |
console.log(arr[10] === undefined); // still undefined | |
console.log(10 in arr); // false <-- does not create empty properties. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment