summaryrefslogtreecommitdiffhomepage
path: root/javascript.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r--javascript.html.markdown6
1 files changed, 6 insertions, 0 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown
index 6b6be34d..2ac98105 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -38,6 +38,8 @@ doStuff()
// 1. Numbers, Strings and Operators
// Javascript has one number type (which is a 64-bit IEEE 754 double).
+// As with Lua, don't freak out about the lack of ints: doubles have a 52-bit
+// mantissa, which is enough to store integers up to about 9✕10¹⁵ precisely.
3; // = 3
1.5; // = 1.5
@@ -142,6 +144,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"};