What is the difference between var and let in terms of scope in JavaScript?
A). a. Both have function scope
B). b. Both have block scope
C). c. var has block scope, let has function scope
D). d. var has function scope, let has block scope
Which keyword is used to declare a variable that cannot be reassigned in JavaScript?
A). a. var
B). b. let
C). c. const
D). d. mutable
Which of the following variable names is valid in JavaScript?
A). a. my variable
B). b. _variable
C). c. 3variable
D). d. variable$
What will console.log(a); output if a is declared outside a function but inside a block using let in JavaScript?
A). a. It will output the value of a
B). b. It will throw an error
C). c. It will output undefined
D). d. It
What is the outcome of console.log(typeof x); if x is declared but not initialized in JavaScript?
A). a. Undefined
B). b. Null
C). c. Error
D). d. Object
What does hoisting refer to in JavaScript variable declarations?
A). a. Declaring a variable multiple times
B). b. Initializing a variable before declaring
C). c. Moving variable declarations to the top
D). d. Using undeclared variables
What is the outcome of console.log(typeof x); if x is declared but not initialized in JavaScript?
A). a. Undefined
B). b. Null
C). c. Error
D). d. Object
What does hoisting refer to in JavaScript variable declarations?
A). a. Declaring a variable multiple times
B). b. Initializing a variable before declaring
C). c. Moving variable declarations to the top
D). d. Using undeclared variables
What keyword is used to declare variables in JavaScript?
A). a. var
B). b. const
C). c. let
D). d. def
What keyword is used to declare variables in JavaScript?
A). a. var
B). b. const
C). c. let
D). d. def