Javascript Dev 1 Cert Flashcards
The name of a variable is called ___
Identifier
____ can be used to declare a local or global variable and can be initialed to a value
var
____ can be used to declare a block-scoped, local variable and can be initialized
let
___ can be used to declare a block-scoped, read-only constant. It must be initialized to a value.
const
What is the value of var1?
let var1;
undefined
What is the value of var1?
var var1;
undefined
What data type is this?
let var1 = 123444555666777n;
BigInt
What is the output?
let field1 = Symbol('field'); let field2 = Symbol('field'); console.log(field1 === field2); console.log(Symbol('field') == Symbol('field'));
false
false
What is the output?
let record = {}; record = null; console.log(typeof record);
object
What is the output?
let var1 = undefined; let var2 = null; console.log(var1 == var2);
true
What is the output?
let var1 = NaN; let var2 = NaN; console.log(var1 == var2); console.log(var1 === var2);
false
false
nothing is ever equal to NaN
What is the output?
let var1 = -0; let var2 = 0; console.log(var1 == var2); console.log(var1 === var2);
true
true
What is the output?
const bool = true; const str = '5'; console.log(str == 5);
true
trick question! don’t let this mess you up
What is the output?
const bool = true; console.log(bool == 5);
false
What is the output?
const bool = true; console.log(+bool); console.log(typeof +bool);
1 Number
What is the output?
const str = '5'; console.log(+str); console.log(typeof +str);
5 Number
What is the output?
const bool = true; const str = '5'; console.log(bool & str); console.log(bool && str);
1
5
What is the output?
const bool = true; const str = '5'; console.log(bool == str); console.log(bool === str);
false
false
What is the output?
let name; console.log(typeof name);
undefined
What is the output?
console.log(Array.from('123'));
[“1”, “2”, “3”]
What is the output?
Array.of('jan', 'feb', 'mar');
[“jan”, “feb”, “mar”]
What character is used to define a template literal string?
Backtick character (`)
When a date object is created, what does it actually contain?
A number representing the number of milliseconds since 00:00:00 UTC on January 1st, 1970.
What are two ways to create a number?
A number literal and the Number constructor.