HR/Admin : +91-7827547816
Sales : +91-7827547816
+91-9599109956
training@techspakes.com
Toggle navigation
Home
Training Courses
HTML
Website Development
WordPress Development
Front End Development
Graphics Designer
Linux Admin
MERN
Angular
Hybrid Mobile App
Drupal
Full Stack
React Native Developer
MVC
MEAN
SMM
SEO
SMO
Lead Generation
Web Development Training in Noida
Web Development Training in Jaipur
Computer Training in Narnaul
Computer Training in Satnali
Our Locations
Computer Training in Dahina
Computer Training in Mahendergarh
Computer Training in Narnaul
Computer Training in Satnali
Computer Training in Rewari
Computer Training in Kanina
Computer Training in Ateli Mandi
Computer Training in Bhiwani
Computer Training in Charkhi Dadri
Interview Questions
HTML Interview Questions
CSS Interview Questions
Bootstrap4 Interview Questions
Bootstrap5 Interview Questions
Javascript Interview Questions
IT Services
Testimonial
Our Top Placements
Contact
Top 500 Javascript MCQ Interview Questions
Training
Top 500 Javascript MCQ Interview Questions
Question 251:
What will console.log([1, 2, 3].map(x => x * 2)); output?
A) [1, 2, 3]
B) [2, 4, 6]
C) [2, 3, 4]
D) undefined
Answer:
B) [2, 4, 6]
Question 252:
Which of the following is used to create a new array from an existing array?
A) map()
B) filter()
C) slice()
D) All of the above
Answer:
D) All of the above
Question 253:
What is the output of console.log(true && false);?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 254:
Which of the following will throw a reference error?
A) console.log(a);
B) console.log(undefined);
C) console.log(null);
D) All of the above
Answer:
A) console.log(a);
Question 255:
What is the output of console.log([] + []);?
A) ""
B) []
C) error
D) undefined
Answer:
A) ""
Question 256:
What is the output of console.log(1 + 2 + '3' + 4);?
A) 1234
B) 10
C) 15
D) undefined
Answer:
A) 1234
Question 257:
Which method can be used to transform each element in an array?
A) map()
B) filter()
C) forEach()
D) reduce()
Answer:
A) map()
Question 258:
What will console.log('hello'.toUpperCase()); output?
A) hello
B) HELLO
C) Error
D) undefined
Answer:
B) HELLO
Question 259:
What is the output of console.log('x' + 'y' + 1);?
A) xy1
B) xy
C) 1xy
D) error
Answer:
A) xy1
Question 260:
Which of the following will cause a TypeError?
A) console.log(undefined + null);
B) console.log(null + 1);
C) console.log(1 + '1');
D) console.log(1 + 2 + undefined);
Answer:
D) console.log(1 + 2 + undefined);
Question 261:
What is the output of console.log([1, 2, 3].reverse());?
A) [1, 2, 3]
B) [3, 2, 1]
C) error
D) undefined
Answer:
B) [3, 2, 1]
Question 262:
Which method can be used to sort an array?
A) sort()
B) orderBy()
C) arrange()
D) filter()
Answer:
A) sort()
Question 263:
What is the output of console.log(false == '0');?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 264:
What is the result of [1, 2, 3].concat([4, 5]);?
A) [1, 2, 3, 4, 5]
B) [1, 2, 3][4, 5]
C) [4, 5]
D) error
Answer:
A) [1, 2, 3, 4, 5]
Question 265:
What is the output of console.log(typeof NaN);?
A) number
B) NaN
C) string
D) undefined
Answer:
A) number
Question 266:
Which of the following is an invalid variable name?
A) myVar
B) _myVar
C) 1myVar
D) $myVar
Answer:
C) 1myVar
Question 267:
What is the output of console.log(typeof null);?
A) object
B) null
C) undefined
D) number
Answer:
A) object
Question 268:
What will console.log([2, 4, 6].slice(1)); output?
A) [4, 6]
B) [2, 4]
C) [6]
D) error
Answer:
A) [4, 6]
Question 269:
What is the output of console.log('1' == 1);?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 270:
What is the output of console.log([1, 2, 3].join('-'));?
A) 1-2-3
B) 123
C) [1, 2, 3]
D) error
Answer:
A) 1-2-3
Question 271:
Which of the following is NOT a primitive data type in JavaScript?
A) String
B) Number
C) Object
D) Boolean
Answer:
C) Object
Question 272:
What is the output of console.log('5' + 5);?
A) 10
B) 55
C) error
D) undefined
Answer:
B) 55
Question 273:
Which method is used to add an element at the end of an array?
A) push()
B) pop()
C) shift()
D) unshift()
Answer:
A) push()
Question 274:
What will console.log([1, 2, 3].indexOf(2)); output?
A) 1
B) 2
C) 0
D) -1
Answer:
B) 1
Question 275:
What does JSON stand for?
A) JavaScript Object Notation
B) JavaScript Online Notation
C) Java Source Object Notation
D) None of the above
Answer:
A) JavaScript Object Notation
Question 276:
What will console.log(typeof [1, 2, 3]); output?
A) object
B) array
C) number
D) undefined
Answer:
A) object
Question 277:
What is the output of console.log(0.1 + 0.2 === 0.3);?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 278:
Which operator is used to assign a value to a variable?
A) =
B) ==
C) ===
D) !==
Answer:
A) =
Question 279:
What is the output of console.log('a' + + 'b');?
A) ab
B) NaN
C) error
D) undefined
Answer:
B) NaN
Question 280:
What is the output of console.log(2 + 3 + '7');?
A) 57
A) 12
C) 5
D) error
Answer:
A) 57
Question 281:
What will console.log(typeof null); output?
A) object
B) null
C) undefined
D) error
Answer:
A) object
Question 282:
Which of the following is a way to define a variable in JavaScript?
A) var
B) let
C) const
D) All of the above
Answer:
D) All of the above
Question 283:
What is the output of console.log('1' == 1);?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 284:
Which of the following is not a looping structure in JavaScript?
A) for
B) while
C) foreach
D) do-while
Answer:
C) foreach
Question 285:
What is the output of console.log(typeof [1, 2, 3].length);?
A) number
B) string
C) object
D) undefined
Answer:
A) number
Question 286:
What is the output of console.log([] + 'abc');?
A) abc
B) [object Object]
C) error
D) undefined
Answer:
A) abc
Question 287:
Which method is used to convert a JSON string into a JavaScript object?
A) JSON.stringify()
B) JSON.parse()
C) JSON.convert()
D) None of the above
Answer:
B) JSON.parse()
Question 288:
What is the output of console.log([1, 2, 3].join('-'));?
A) "1-2-3"
B) "123"
C) "1,2,3"
D) error
Answer:
A) "1-2-3"
Question 289:
What is the output of console.log(1 === '1');?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 290:
Which of the following is a method of the Math object?
A) Math.random()
B) Math.floor()
C) Math.ceil()
D) All of the above
Answer:
D) All of the above
Question 291:
What is the output of console.log('a' > 'A');?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 292:
Which of the following is a correct way to create a new array in JavaScript?
A) var arr = [];
B) var arr = new Array();
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 293:
What will console.log(3 + 4 + '5'); output?
A) 12
B) 75
C) 8
D) 34
Answer:
B) 75
Question 294:
Which of the following is a valid way to declare a constant?
A) const x = 10;
B) var x = 10;
C) let x = 10;
D) All of the above
Answer:
A) const x = 10;
Question 295:
What is the output of console.log(Math.max(1, 2, 3));?
A) 1
B) 2
C) 3
D) error
Answer:
C) 3
Question 296:
What will console.log('5' + 5); output?
A) 10
B) 55
C) "5 5"
D) error
Answer:
B) 55
Question 297:
Which of the following is true about JavaScript functions?
A) Functions can be stored in variables.
B) Functions can be passed as arguments.
C) Functions can return other functions.
D) All of the above
Answer:
D) All of the above
Question 298:
What is the output of console.log(0 == false);?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 299:
What will console.log(typeof NaN); output?
A) number
B) NaN
C) undefined
D) error
Answer:
A) number
Question 300:
Which of the following is a correct way to define a string?
A) let str = "Hello";
B) let str = 'Hello';
C) let str = \`Hello\`;
D) All of the above
Answer:
D) All of the above
«
1
2
3
4
5
6
7
8
9
10
»
Showing 251-300 of 500 questions