Syntax intro Flashcards
What is a template literal?
String literal that adds to expressions through interpolation.
Denoted by “ ` “ the backtick.
const myPet = 'armadillo'; console.log(`I own a pet ${myPet}.`); // Output: I own a pet armadillo.
What are template literals wrapped with?
Backticks.
`
What operator is useful to check the data type of a variable’s value?
typeof
What are strings wrapped with?
Apostrophes.
What is the preferred way to declare a variable when it can be reassigned?
let
What is the preferred way to declare a variable with constant value?
const
What is the primitive data type of variables that have not been initialized?
undefined
what operator is used to consecrate strings?
+
What is a Method?
Methods return information about an object, and are called by appending an instance with a period ., the method name, and parentheses.
return a floating-point, random number in the range from 0 (inclusive) up to but not including 1.
Math.random()
return the largest integer less than or equal to the given number.
Math.floor()
intentional absense of value
null
Modulo
%
finds the remainder
10 % 5
single line comment
//
multi line comment
/* */
What is faster ABOVE 30 substrings, interpolation or concatenation?
Interpolation