From 9c0e7c548d3fb0cf655f282e36b1c24b21bba83b Mon Sep 17 00:00:00 2001 From: Adam Brenecki Date: Thu, 10 Oct 2013 08:33:39 +1030 Subject: [PATCH] [javascript] Add bit about array mutability. Closes #381. --- javascript.html.markdown | 4 ++++ 1 file changed, 4 insertions(+) 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"};