JavaScript - Quiz Questions
1. Which keyword is used to declare a block-scoped variable that cannot be reassigned?
let
var
const
block
2. What is the correct way to create a new array in JavaScript?
var myArray = [1, 2, 3];
var myArray = new Array(1, 2, 3);
var myArray = {1, 2, 3};
var myArray = array(1, 2, 3);
3. What is the output of the following code? console.log(amit); var amit = 10;
"null"
"undefined"
"object"
"string"
4. Which built-in method can be used to find the index of the first occurrence of a value in an array?
indexOf()
findIndex()
search()
getIndex()
5. What does the === operator do in JavaScript?
It assigns a value to a variable.
It checks for equality of values, but not data types.
It checks for equality of both values and data types.
It performs a logical OR operation.

Your Score: 0

Read Our blogs