let num = 1;
let newNum = num++;
console.log(num);
console.log(newNum);
num will return 2, and
newNum will return 1.
As num was assigned to newNum, newNum becomes 1. And, as num++ is called, num becomes 2.
myArray[myArray.length - 1]
push
adds an element in the end of an array.let month = [1, 2, 3, 4];
month.push(5);
>> month = [1, 2, 3, 4, 5]
unshift
adds an element at the beginning of an array.let month = [1, 2, 3, 4];
month.push(0);
>> month = [0, 1, 2, 3, 4]
pop
removes the element of an array.let month = [1, 2, 3, 4];
month.pop();
>> month = [1, 2, 3]
data = "string";
typeof data;
>> type - string
data = true;
typeof data;
>> type - boolean
indexOf
let word = "I am from the States.";
>> word.indexOF('m') == 3
let word = "I am from the States.";
>> word.slice(0,6) == "I am fr"
>> word.slice(7, word.length) == "om the States."