Comment

node
// Single line comment

/*
Multiple
line
comment
*/

Variable

node
// Declaration
var stuff;
// Assignment
stuff = "stuff";

// Declaration and assignment
var stuff = "stuff";

String

node
"Single line string";

Integer

node
42;

Boolean

node
true;
// or
false;

Array

node
["stuff", "things"];

Object

node
{stuff_key: "stuff_value", things_key: "things_value"};

For Loop

node
// Iterate list
for (var i=0; i < things.length; i++) {
    console.log(things[i]);
}

// Alternate syntax
for (var i in things) {
    console.log(things[i]);
}

// Iterate dictionary

While Loop

node
var i = 0;
while (i < things.length) {
    console.log(things[i]);
    i++;
}

If, Else if, Else

node
if (1 > 42) {
    console.log("One");
} else if (42 < 1) {
    console.log("The answer");
} else {
    console.log("Maths is fun");
}

Function

node
function stuff() {
    stuff = ["stuff", "things"];
    return stuff;
}

Class

node
class Stuff {
    constructor(stuff) {
      this.stuff = stuff;
    }
    set stuff(stuff) {
      this._stuff;
    }
    get stuff() {
      return this._stuff;
    }
    showStuff() {
      console.log(this.stuff)
    }
}