alert("text");
This is used to bring up pop-ups that say the text(string) inside of the ().
Used to create a popup that will ask a user something.
You should probably store this value inside a variable, as this will not be committed to memory.
var variable = prompt(string);
typeof(variable);
This tells you the type of the variable.
var YourName ="name";
Used to indicate that we are creating a new variable with the name, YourName. This stores the string "name".
We can find out how many characters are in strings.
var.length;
By the way, string concat does exist in JS. Just combine the values by using the "string" + variable. Only things inside of the quote marks are displayed.
Alert("hello" + "world); releases a alert that says "hello world"
We are able to take portions of strings.
variable.slice(startingpos,endingpos). By the way, this is 0 indexed.
To know how many characters you will be taking, endingpos - startingpos.
var.toUpperCase()
var.toLowerCase()
You can do equations in Javascript
Math is done with precednce. However, we can speicfy what parts of an eq happens first by using paren ().
This function finds and returns the remainder.
This gives us a different answer than if we were to divide.
We can use this in the case that we wanted to find out if a number is even or odd, for example.
Increment/Decrement
Increment and decrement based on a single value
Var++;
var--;
Increment and decrement multiple values
var+=2; // var = var + 2
var +=z;// var= var + z