Syntax & Operators Flashcards
What is the value of ‘this’ in an event handler?
The instance of the HTML element with the event handler
In an object literal, what does ‘this’ refer to?
The object itself
What happens if you forget a break statement?
Execution falls through to the next case statement
What does the spread operator do?
- Expands an iterable object such as a string or array into another array.
- Can be used to pass multiple arguments into a method
What is the syntax for the spread operator?
(…) immediately preceding an expression (on the right hand side)
How do you define a label in JavaScript?
On a separate line create a name followed by a colon
What is the value of result in the following statement?
let result = 10;
result += 5;
15
What error type is thrown if you have an error in the eval() function?
SyntaxError
Which object data types should you avoid?
Date, Number, String
What is the value of ‘this’ in the call or apply method?
A reference to the object passed to call or apply
What is the value of ‘this’ in a constructor function?
The object itself
What does the continue statement do?
Goes back to the top of a loop and continues with next iteration
When ++ or – is placed after a variable, what happens?
The current value of the variable is used, then incremented/decremented (respectively)
What is the correct syntax for use strict?
‘use strict’;
What is passed to the catch block?
An error object