JavaScript General Knowledge Flashcards
What is the piece of code written between curly braces { } of an if statement is called?
Code block
Can you create multiple word property names? How is this done?
Yes they must be created in quotes.
Describe the function of the colon ’:’ character in a ternary expression with multiple cases.
The ’:’ character works essentially as an ‘else if’ clause after the second case.
How are default parameters specified?
By assigning the parameters in the parentheses a value using =.
If given no value or undefined for name when called, the function will use ‘stranger’.
How are function expressions declared using arrow notation?
As function expressions are usually declared, minus the function keyword, and adding the fat arrow => between the parentheses and the code block.
How are multi-line comments fomatted?
By commenting between /* and */.
How are parameters specified in function declarations?
Within the parentheses, separated by commas.
How are single line comments formatted?
Using //
How are template literals formatted?
Using backticks `` instead of quotation marks
How are variables inserted into template literals?
Inside the curly braces of ${}.