Some notes for me to refer and remind myself
unlike PHP, a variable must be declared first before been assigned. or it can be declared and assigned at the same time
var myVar = 1;
to get string length:
stringLength = aString.length;
to get nth letter in a string
letter = aString[aString.length-1] // get the last letter
array in javascript. array can also contains array as element
myArray = [“this is string”, 200, true, [“Bulls”, 23]];
use .push() to push element to an array. .pop() to remove last element. .shift() to remove first element and return the element (can assign to a variable)
myArray.push(“another element”);
deletedLastElement = myArray.pop();