Variables, Output, Basic Math

Variables

// let creates a block scoped variable that can be re-assigned
let intager = 9;
let float = 9.9;

let string = 'this is a string';

let boolean = true;

let value = null;

// creates undefined variable
let value;

// var creates a function scoped variable that can be re-assigned
var value = '';

// const creates a none re-assignable variable
const value = 78;
// concatenation
string = 'hello' + ' again';
string += ' and again';

// interpolation
string = 'Yes ' + text + ' come with you';
string = 'Yes ${text} come with you';

Output

console.log('text here');
// text here  is logged

console.log(string.length);
// outputs the length of the string (base 1)

Math

// Addition
5 + 5
// Subtraction
10 - 5
// Multiplication
5 * 10
// Division
10 / 5
// Modulo
10 % 5
val += 5;

val -= 5;

val *= 5;

val /= 5;

val %= 5;