-
What is the correct way to declare a variable in JavaScript?
a) var x = 10;
b) variable x = 10;
c) let x = 10;
-
What will be the output of the following JavaScript code snippet?
var x = 10;
console.log(typeof x);
x = "hello";
console.log(typeof x);
a) number and string
b) string and number
c) number and number
-
Which of the following loops is used for iterating over the properties of an object in JavaScript?
a) for
b) while
c) for...in
-
Which JavaScript block is used for error handling and recovery in a program?
a) try
b) catch
c) finally
-
What is the keyword used in JavaScript to throw an exception manually?
a) throw
b) try
c) error
-
Which JavaScript method is used to parse a string and return a JavaScript object?
a) parseJSON
b) stringify
c) toJSON
-
In which language is JavaScript primarily implemented?
a) C++
b) Java
c) JavaScript
-
What will be the output of the following JavaScript code?
var a = [1, 2, 3];
var b = a;
b[0] = 5;
console.log(a);
a) [1, 2, 3]
b) [5, 2, 3]
c) [1, 2, 3, 5]