Beginning JavaScript Vocabulary
Quiz yourself by thinking what should be in
each of the black spaces below before clicking
on it to display the answer.
Help!
|
|
||||
---|---|---|---|---|---|
Array Literals | The most common of which is to list values in a pair of square brackets. JavaScript arrays can contain any types of values and they can be of mixed types.
🗑
|
||||
Accessing Array Elements | You can get elements out of arrays if you know their index,indexes start at 0 and increment by 1
🗑
|
||||
Multi-Dimensional Arrays | The two-dimensional arrays are the arrays within arrays. If you fill this array with another array you get a three-dimensional array and so on and so forth
🗑
|
||||
Array Constructor | You can also create an array using the Array constructor
🗑
|
||||
Accessing nested array elements | They are accessed by using [index][index]..... (number of them depends upon the number of arrays deep you want to go inside).
🗑
|
||||
Boolean Literals | true or false
🗑
|
||||
Boolean logical operators | expression1 && expression2 //returns true if both the expressions evaluate to true
expression3 || expression4 // return true if either one of the expression evaluates to true
!expression5 // returns the opposite boolean value of the expression
🗑
|
||||
Comparison Operators | x === y // returns true if two things are equal
x !== y // returns true if two things are not equal
x <= y // returns true if x is less than or equal to y
x >= y // returns true if x is greater than or equal to y
🗑
|
||||
Note | Not only Boolean literals (true and false) assert truth or false , but there are some other ways too to derive true or false. Such as,if(1)console.log("True!"); // output True! , since any non-zero number is considered to be true
🗑
|
||||
== vs. === | A simple explanation would be that == does just value checking ( no type checking ) , whereas , === does both value checking and type checking
🗑
|
||||
Code Comments | Code comments are used for increasing the readability of the code.If you write 100 lines of code and then forget what each function did , it's not useful at all
🗑
|
||||
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 commen
🗑
|
||||
Console.log | Prints text to the console. Useful for debugging.
🗑
|
||||
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().
🗑
|
||||
Function definition | A function is a JavaScript procedure—a set of statements that performs a task or calculates a value
🗑
|
||||
Function Calling | functionName(argument1, argument2, ..., argumentN);
🗑
|
||||
Function Hoisting | Declaring a function one way "hoists" it to the top of the call, and makes it available before it's actually defined.
🗑
|
||||
IF | It simply states that if this condition is true , do this , else do something else ( or nothing ) . It occurs in varied forms.
🗑
|
||||
Else | A fallback to an if statement. This will only get executed if the previous statement did not.
🗑
|
||||
Else If | 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
🗑
|
||||
For Loops | You use for loops, if you know how often you'll loop. The most often used varName in loops is "i".
🗑
|
||||
While Loops | You use while loops, if you don't know how often you'll loop
🗑
|
||||
Do While Loops | You use do while loops, if you have to loop at least once, but if you don't know how often.
🗑
|
||||
Random | Returns a random number between 0 and 1
🗑
|
||||
Floor | Returns the largest integer less than or equal to a number.
🗑
|
||||
pow | Returns base raised to exponent
🗑
|
||||
Ceil | Returns the smallest integer greater than or equal to a number.
🗑
|
||||
PI | Returns the ratio of the circumference of a circle to its diameter, approximately 3.14159 or in better terms, the value of PI (π). Note in syntax , we do not put `()` at the end of `Math.PI` because `Math.PI` is not a function.
🗑
|
||||
SQRT | Returns the square root of a number.
🗑
|
||||
% (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 | Doing basic arithmetic is simple
🗑
|
||||
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. Classes are a fundamental component of object-oriented programming (OOP).
🗑
|
||||
Alert | Display an alert dialog with the specified message and an OK button.
🗑
|
||||
Confirm | confirm("message") //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
🗑
|
||||
Concatenation | Strings are text
🗑
|
||||
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.
🗑
|
||||
chartAt() | 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. The indexOf method is case sensitive.
🗑
|
||||
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
🗑
|
Review the information in the table. When you are ready to quiz yourself you can hide individual columns or the entire table. Then you can click on the empty cells to reveal the answer. Try to recall what will be displayed before clicking the empty cell.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
To hide a column, click on the column name.
To hide the entire table, click on the "Hide All" button.
You may also shuffle the rows of the table by clicking on the "Shuffle" button.
Or sort by any of the columns using the down arrow next to any column heading.
If you know all the data on any row, you can temporarily remove it by tapping the trash can to the right of the row.
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.
Normal Size Small Size show me how
Normal Size Small Size show me how
Created by:
2016harlowd
Popular Computers sets