summaryrefslogtreecommitdiffhomepage
path: root/javascript.html.markdown
diff options
context:
space:
mode:
authorAdam Brenecki <adam@brenecki.id.au>2015-10-28 13:26:24 +1030
committerAdam Brenecki <adam@brenecki.id.au>2015-10-28 13:26:24 +1030
commitc83eb6c6bca63b28a11b975cc64db5723e94b240 (patch)
tree1bd1ca3ba5d481c2e64b03799e6de9ced386353c /javascript.html.markdown
parent9d2efe69d0bd1c29dcb5dd32283caf1b6723d23d (diff)
[javascript/en] Move comparisons to other languages into preamble
Diffstat (limited to 'javascript.html.markdown')
-rw-r--r--javascript.html.markdown13
1 files changed, 8 insertions, 5 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown
index 5bac3aa7..3f9eb641 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -16,9 +16,14 @@ JavaScript isn't just limited to web browsers, though: Node.js, a project that
provides a standalone runtime for Google Chrome's V8 JavaScript engine, is
becoming more and more popular.
+JavaScript has a C-like syntax, so if you've used languages like C or Java,
+a lot of the basic syntax will already be familiar. Despite this, and despite
+the similarity in name, JavaScript's object model is significantly different to
+Java's.
+
```js
-// Comments are like C's. Single-line comments start with two slashes,
-/* and multiline comments start with slash-star
+// Single-line comments start with two slashes.
+/* Multiline comments start with slash-star,
and end with star-slash */
// Statements can be terminated by ;
@@ -145,7 +150,7 @@ someOtherVar = 10;
// Variables declared without being assigned to are set to undefined.
var someThirdVar; // = undefined
-// If you want to declare a couple of variables, then you could use a comma
+// If you want to declare a couple of variables, then you could use a comma
// separator
var someFourthVar = 2, someFifthVar = 4;
@@ -194,8 +199,6 @@ myObj.myFourthKey; // = undefined
///////////////////////////////////
// 3. Logic and Control Structures
-// The syntax for this section is almost identical to Java's.
-
// The `if` structure works as you'd expect.
var count = 1;
if (count == 3){