summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Brenecki <adam@brenecki.id.au>2013-10-10 08:33:39 +1030
committerAdam Brenecki <adam@brenecki.id.au>2013-10-10 08:33:39 +1030
commit9c0e7c548d3fb0cf655f282e36b1c24b21bba83b (patch)
treea28b459c32ba770fa03ddace3536386908e0228d
parentd2ee4711a7f8bb72a3c5b9df0ab3845716cb2a65 (diff)
[javascript] Add bit about array mutability.
Closes #381.
-rw-r--r--javascript.html.markdown4
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"};