Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
24 Cards in this Set
- Front
- Back
What is an expression? |
An expression is a "fragment" of code that produces a value.
|
|
What is a statement?
|
A statement is a full "sentence" of code that produces a value.
|
|
What are variables?
|
Variables are containers for storing data values. They grasp data values. Written as var.
|
|
What is the javascript enviroment?
|
An enviroment is the collection of variables and their values that exist at a given time.
|
|
What is a function?
|
A JavaScript function is a block of code designed to perform a particular task.
|
|
What are three words that we can use to describe the execution of a function?
|
They are: Invoking, calling, or applying a function.
|
|
What does Math.max() do?
|
The function Math.max() takes any number of number values and gives back the greatest.
console.log(Math.max(2, 4)); // → 4 |
|
What is a function return?
|
When a function produces a value, it is said to return that value.
|
|
What does the function Number do?
|
The function Number converts a string number value to a number.
ex var data = "18"; console.log(Number.data) // 18 |
|
How do we perform a conditional execution?
|
We perform it by executing statements where we choose between two different routes based on a Boolean value.
Example if/if else/else statements |
|
What is an if statement and how do we declare it?
|
With the if statement, code will only execute if, and only if, a certain condition holds.
Example: if(condition){ code block; }; |
|
What is the isNaN function?
|
The isNaN function is a standard JavaScript function that returns true only if the argument it is given is NaN.
|
|
What is an if/else statement and how do we declare it?
|
Conditional statements are used to perform different actions based on different conditions.
Example: if (condition) { block of code to be executed if the condition is true } else { block of code to be executed if the condition is false } |
|
What is a loop?
|
Loops can execute a block of code as long as a specified condition is true.
while (condition) { code block to be executed } |
|
What is a do/while loop and how do we declare it it?
|
This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true.
Example : do { code block to be executed } while (condition); |
|
What is a For loop and how do we declare it?
|
Loops through a block of code a number of times.
Example: for (statement 1; statement 2; statement 3) { code block to be executed } |
|
How do you break out of a for loop?
|
We use the break; keyword, break has effect of immediately jumping out of the enclosing loop.
Example: for (i = 0; i < 10; i++) { if (i == 3) break; text += "The number is " + i + "<br>"; } |
|
How do we continue in the loop?
|
The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.
This example skips the value of 3: Example for (i = 0; i <= 10; i++) { if (i == 3) continue; text += "The number is " + i + "<br>"; } |
|
How do we write one var w/ multiple variables?
|
A single var statement may define multiple variables. The definitions must be separated by commas.
Example: var one = 1, two = 2; |
|
What is a straight control flow of the program?
|
Executing statements one after another.
|
|
How would you test if a variable is a string or not? |
Applying the ! operator will convert a value to Boolean type before negating it, and all strings except ""convert to true. |
|
How would you test if a variable is a number or not?
|
The isNaN function is a standard JavaScript function that returns true only if the argument it is given is NaN.
|
|
What's the difference between for and while loop? |
A for loop is easier to use when you're clearly counting from one thing to another. |
|
What are the three parts of a for loop? |
1)The part before the first semicolon initializes the loop, usually by defining a variable. 2)The second part is the expression that checks whether the loop must continue. 3)The final part updates the state of the loop after every iteration. |