diff options
author | Adam Brenecki <adam@brenecki.id.au> | 2013-10-10 08:33:39 +1030 |
---|---|---|
committer | Adam Brenecki <adam@brenecki.id.au> | 2013-10-10 08:33:39 +1030 |
commit | 9c0e7c548d3fb0cf655f282e36b1c24b21bba83b (patch) | |
tree | a28b459c32ba770fa03ddace3536386908e0228d /javascript.html.markdown | |
parent | d2ee4711a7f8bb72a3c5b9df0ab3845716cb2a65 (diff) |
[javascript] Add bit about array mutability.
Closes #381.
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r-- | javascript.html.markdown | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown index 6b6be34d..97c5b712 100644 --- a/javascript.html.markdown +++ b/javascript.html.markdown @@ -142,6 +142,10 @@ var myArray = ["Hello", 45, true]; // Array indices start at zero. myArray[1]; // = 45 +// Arrays are mutable and of variable length. +myArray.push("World"); +myArray.length; // = 4 + // JavaScript's objects are equivalent to 'dictionaries' or 'maps' in other // languages: an unordered collection of key-value pairs. var myObj = {key1: "Hello", key2: "World"}; |