Flashcards
JavaScript
Cards in this deck (34)
- 1What is the var statement?The var statement declares a global scope variable
- 2What is the let statement?The let statement declares a block scope local variable
- 3what is the const statement?Constants are block-scoped, much like variables defined using the let statement. The value of a constant cannot change through re-assignment, and it can't be re-declared.
- 4How do you display to the console?console.log();
- 5What are the mathematical operators?(+) = plus
(- )= minus
(/) = division no remainder
(%) = Modulus remainder - 6What is the purpose of an Assignment Operator?Uses the current value of a variable, and adds another value
- 7What is string interpolation?The JavaScript term for inserting data saved to a variable into a string
- 8`What are back ticks ?`Same as typing a string but you can insert variables though formatting with `${Variable}`
- 9What is an if statement?An if statement takes a parameter with a Boolean expression if condition is true it executes the block of code
- 10What is an else statement?An else statement is followed by an if statement it is a block of code that is executed when the condition in the if statement is false
- 11In JavaScript, all values have a truthy or falsy value what variables return false?False, 0 & -0, "" & '', null, undefined, NaN
- 12What does the !not operator do?The !not operator makes a true statement false and false statement true
- 13What are the comparison operators and what do they return?< , >, <=, >=
These Operators return true or false - 14What are the comparison operators and what do they do?"===" Checks if two values are equal to each other
"!==" Check if two values are not equal to each other - 15What is an "else if" statement?An else if statement checks another Boolean condition when a previous condition is false
- 16What is the structure of a switch statement?switch (variable) {
case 'possible condition' :
"block of code to execute"
break;
case 'possible condition' :
"block of code to execute"
break;
default:
"block of code to execute"
break;
} - 17What are the logic operators?&& , ||
- 18What is a Ternary Operator?converts a simple if/else structured block into a single line short hand ex.
Boolean value ? if true execute this : else execute this; - 19What is the structure of an arrow function?cons function name = (parameter) => {
Code block to execute
};
a function can have as many parameters needed - 20What is the return keyword?The return keyword returns a value inside of a function
- 21What is the Structure of a Function Declarationfunction "name" (parameter) {
code block
} - 22What is the Structure of a Function Expression?const name = function (parameter) {
code block
};
Function Expressions omit the identifier following the function key word usually stored in variables - 23Refactoring Arrow FunctionsFunctions that take a single parameter do not need a parenthesis, a return, or brackets. An implicit return occurs
- 24How do you declare an array?let "name" = [Array Elements];
- 25How do you return the amount of elements in an array?array.length;
- 26How do you access an index of an array?array[index];
- 27How do you re-assign an element value?array[index] = "value";
- 28What does the push method do?array.push(parameter);
Takes the values of the parameters and pushes those elements to the end of the array elements. - 29What does the pop method do?array.pop()
The pop() method removes the last element from an array and returns that element. This method changes the length of the array. - 30What does the shift method do?The shift() method removes the first element from an array and returns that removed element. This method changes the length of the array.
- 31What does the slice method do?The slice(from index, to index) method returns a a new string by extracting the index range of he original array.
The original array will not be modified. - 32What does the splice method do?The splice(index selected, amount of elements to be removed, replacement value) method changes the contents of an array by removing existing elements and/or adding new elements.
- 33What does the splice method do?The join() method joins all elements of an array (or an array-like object) into a string and returns this string.
- 34—