Term | Definition |
Array literals | list of values in a pair of square brackets |
Boolean literals | Boolean literals (true and false) assert truth or false |
Code Comments | Used to describe lines of code and tell what they do so you don't forget after writing a lot |
Console | Prints text to the console. Useful for debugging. |
Functions | A function is a set of statements that performs a task or calculates a value |
For Loop | A loop that occurs a set number of times |
While loop | A loop that is used when a statement is true or false |
Do While Loop | A loop that is done at least once, then turned into a while loop |
Random | Returns a number between 0 and 1 |
Floor | Returns the largest integer less than or equal to a number |
Multi-dimensional Arrays | A two-dimensional array is an array within an array |
Pow | Returns base raised to exponent |
Ceil | Returns the smallest integer greater than or equal to a number |
Pi | Returns the number Pi π |
Sqrt | Returns the square root of a number |
If statement | If the condition is true, do this. If not, do something else |
Else statement | A fallback to an if statement. This will only get executed if the previous statement did not. |
Else If statement | This is like an else statement, but with its own condition. It will only run if its condition is true, and the previous statement's condition was false. |
console.log | Prints text to the console |
console.time | This function starts a timer which is useful for tracking how long an operation takes to happen |
console.timeEnd | Stops a timer that was previously started by calling console.time() |
Accessing array elements | Getting elements out of their arrays by using their index |
Array constructor | A tool to construct an array with |
Accessing nested array elements | They are accessed by using [index][index] |
Boolean logical operators | Runs true/false statements to try and derive an answer |
Comparison operators | Compares values to get an answer as to what to do |
Note: | not only Boolean literals (true and false) assert truth or false |
== vs. === | == does just value checking ( no type checking ) , whereas , === does both value checking and type checking |
Single Line Comment | Anything on the line following // will be a comment while anything before will still be code |
Multi-Line Comment | Anything between /* and */ will be a comment |
Function calling | Executing a function |
Function hoisting | Declaring a function one way "hoists" it to the top of the call, and makes it available before it's actually defined. |
% (Modulus) | it returns the remainder left after dividing the left hand side with the right hand side. |
isNaN | Returns true if the given number is not a number , else returns false. |
Basic Arithmetic | Simple math |
Prefix and Postfix increment/decrement operators | Prefix increment / decrement operators are operators that first increase the value of the variable by 1 (increment) or decrease the value of an expression / variable by 1 (decrement) and then return this incremented / decremented value |
Object Literals | "property 1": value1,
property2: value2,
number: value3 |
Property Access | name1[string]
name2.identifier |
Classes | A class can be thought of as a template to create many objects with similar qualities |
alert | Display an alert dialog with the specified message and an OK button |
confirm | returns true if confirmed, false otherwise |
prompt | The prompt() displays a dialog with an optional message prompting the user to input some text. If the user clicks the "Cancel" button , null is returned. |
Strings | Strings are text. They are denoted by surrounding text with either single or double quotes. |
Concatenation | string1 + string2 |
length | Returns the length of the string |
toUpperCase, toLowerCase | Changes the cases of all the alphabetical letters in the string. |
trim() | Removes whitespace from both ends of the string. |
replace() | Returns a string with the first match substring replaced with a new substring. |
charAt() | Returns the specified character from a string |
substring() | Returns the sequence of characters between two indices within a string |
indexOf() | Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex, Returns -1 if the value is not found. |
switch | Acts like a big if / else if / else chain. |
Ternary Operator | The ternary operator is usually used as a shortcut for the if statement. |
Variable Assignment | var name = value; |
Variable changing | varname = newValue |