Javascript Fundamentals Flashcards
How do you declare a variable?
let name = value
What are the rules for naming variables?
can’t start with a number
can’t contain special characters except for $ and _
What are operators, operands, and operations?
Operators - the symbol in an operation
Operands - The numbers
Operations - tho sum as a whole
What is concatenation and what happens when you add numbers and strings together?
String concatonation is the joining of multiple strings into one string
What is the difference between == and ===?
Double equals (==) is a comparison operator, which transforms the operands having the same type before comparison.
So, when you compare string with a number, JavaScript converts any string to a number. An empty string is always converts to zero. A string with no numeric value is converts to NaN (Not a Number), which returns false.
What is === in JavaScript?
=== (Triple equals) is a strict equality comparison operator in JavaScript, which returns false for the values which are not of a similar type. This operator performs type casting for equality. If we compare 2 with “2” using ===, then it will return a false value.
What are operator precedence values?
BODMAS
What are the increment/decrement operators?
++
–
What is the difference between prefixing and post-fixing the increment/decrement operators?
the postfix form counter++ also increments counter but returns the old value (prior to increment
What is the “Unary +” Operator?
+=
What are the eight data types of javascript?
number - for numbers of any kind: integer or floating-point, integers are limited by ±253.
bigint - is for integer numbers of arbitrary length.
string - for strings. A string may have zero or more characters, there’s no separate single-character type.
boolean - for true/false.
null - for unknown values – a standalone type that has a single value null.
undefined - for unassigned values – a standalone type that has a single value undefined.
object - for more complex data structures.
symbol - for unique identifiers.
Which data type is NOT primitive?
object
What is the difference between single, double, and backtick quotes for strings?
There’s practically no difference between single and double quotes. Backtick quotes can be used to reference variables inside strings
Which type of quote lets you embed variables/expressions into a string?
backtick quote
How do you embed variables/expressions into a string?
${variable_name}
How do you escape characters in a string?
\