Today I completed The Odin Project JS Fundamentals Part 2 Knowledge Check Section after reviewing all of the materials.
Knowledge Check
- What are the eight data types in JavaScript? Numbers, BigInt, Strings, null, undefined, Boolean, Objects, Symbols
- Which data type is NOT primitive? Objects
-
What is the relationship between null and undefined?
The expression,
null == undefined
, returns true when using the loose equality operator, "==", but not for, "===" - What is the difference between single, double, and backtick quotes for strings? Single and double both behave the same. Backtick quotes can format strings with variables and expressions.
- What is the term for embedding variables/expressions in a string? Template literals
- Which type of quote lets you embed variables/expressions in a string? Backticks
- How do you embed variables/expressions in a string? ${...}
- How do you escape characters in a string? Put a blackslash, "\", in front of a character
- What are methods? Actions performed on Objects
- What is the difference between slice/substring/substr? Slice extracts a part of a string and returns the extracted part in a new string. Substring is similar to slice, but can't use negatives indices Substr is similar to slice, but the second parameter specifies the length of the extracted part.
- What are the three logical operators and what do they stand for? && (AND), || (OR), ! (NOT)
- What are the comparison operators? Operators that compare values between operands
- What are truthy and falsy values? Values that return the boolean value true or false
- What are the falsy values in JavaScript? 0, empty string, null, NaN, and undefined
- What are conditionals? evaluates whether a statement/expression is true or false
- What is the syntax for an if/else conditional? Refer to end
- What is the syntax for a switch statement? Refer to end
-
What is the syntax for a ternary operator?
condition ? value1: value2;
- What is nesting? Putting a statement inside of another statement, therefore nesting them.
For Question 16:
if {
...
} else {
...
}
For Question 17:
switch (condition) {
case a:
code block
break
default:
code block
}
Top comments (0)