Practice javascript Quizzes
Explore javascript in depth with quizzes covering fundamentals to advanced concepts. DevBrainiac's structured quiz format helps you understand theory, apply logic and master problem-solving techniques. With continuous practice, you can track progress, fix mistakes and build strong command of javascript.
Explore All javascript Quizzes
Learn javascript step by step with interactive quizzes designed for beginners and learners revising key concepts. Build a strong foundation with clear, structured practice in javascript.
Question 1
What will be the output of the following code?
console.log(0.1 + 0.2 === 0.3);
1
true
2
undefined
3
false
4
TypeError
Question 2
What will be the output of the following code?
let x = {};
let y = x;
console.log(x === y);1
true
2
false
3
ReferenceError
4
undefined
Question 3
Which of the following is NOT a valid way to declare a JavaScript variable?
1
var x = 10;
2
int x = 10;
3
let x = 10;
4
const x = 10;
Question 4
What will be the output of the following code?
function test() {
console.log(a);
var a = 10;
}
test();1
10
2
undefined
3
TypeError
4
ReferenceError
Question 5
What will be the output of the following code?
function test() {
console.log(a);
let a = 10;
}
test();1
10
2
ReferenceError
3
undefined
4
TypeError
Question 6
What will be the output of the following code?
console.log(typeof null);
1
undefined
2
function
3
object
4
null
Question 7
What will be the output of the following code?
let a = [1, 2, 3]; let b = a; b.push(4); console.log(a);
1
[1, 2, 3]
2
[1, 2, 3, 4]
3
TypeError
4
ReferenceError
Question 8
What will be the output of the following code?
console.log(3 + "3");
1
TypeError
2
3
3
NaN
4
33
Question 9
What will be the output of the following code?
console.log([] == ![]);
1
true
2
ReferenceError
3
false
4
TypeError
Question 10
What will be the output of the following code?
(function() {
var x = 5;
})();
console.log(x);1
ReferenceError
2
5
3
TypeError
4
undefined
Question 11
Which statement is true for let and var in JavaScript?
1
let is function-scoped, and var is block-scoped
2
var is function-scoped, and let is block-scoped
3
Both are function-scoped
4
Both are block-scoped
Question 12
What will be the output of this code?
const fun = function(){
if (true) {
var x = 10;
let y = 20;
console.log(x);
}
console.log(x);
}
fun();1
ReferenceError
2
TypeError
3
10
4
10 10
Question 13
What will be the output of this code?
const fun = function(){
if (true) {
var x = 10;
let y = 20;
console.log(y);
}
console.log(y);
}
fun();1
20 20
2
TypeError
3
ReferenceError
4
20 ReferenceError: y is not defined
Question 14
What will be the output of this code?
const fun = function(){
if (true) {
var x = 10;
let y = 20;
console.log(x);
}
console.log(x);
}
fun();
console.log(x);1
10 10 10
2
10 ReferenceError: x is not defined
3
10 10 ReferenceError: x is not defined
4
ReferenceError: x is not defined
Question 15
In JavaScript, which method is used to get the Unicode of a character?
1
getCode()
2
charCodeAt()
3
asciiCodeAt()
4
codeAt()
Question 16
What is the value of '1' + 1 in JavaScript?
1
NaN
2
2
3
TypeError
4
11
Question 17
In a doubly linked list containing nodes A ↔ B ↔ C ↔ D ↔ E ↔ F, if a pointer p points to node E, then what does p.previous.next refer to?
1
A
2
F
3
D
4
E
