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 401:
What is the output of console.log(2 + '2');?
A) 4
B) '22'
C) '2'
D) error
Answer:
B) '22'
Question 402:
What is the result of console.log(0 == '0');?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 403:
What does the Array.isArray() method do?
A) Checks if an object is an array
B) Converts an array to a string
C) Returns the length of an array
D) None of the above
Answer:
A) Checks if an object is an array
Question 404:
What is the output of console.log('abc'.length);?
A) 3
B) 4
C) undefined
D) error
Answer:
A) 3
Question 405:
What is the result of console.log(typeof NaN);?
A) number
B) NaN
C) undefined
D) error
Answer:
A) number
Question 406:
Which of the following will create a new array?
A) let arr = new Array();
B) let arr = [];
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 407:
Which method is used to add one or more elements to the end of an array?
A) push()
B) pop()
C) shift()
D) unshift()
Answer:
A) push()
Question 408:
What will console.log('5' - 2); output?
A) 3
B) '3'
C) '52'
D) error
Answer:
A) 3
Question 409:
Which of the following is a way to create an object in JavaScript?
A) let obj = {};
B) let obj = new Object();
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 410:
What is the output of console.log(typeof []);?
A) array
B) object
C) undefined
D) error
Answer:
B) object
Question 411:
What is the output of console.log([1] == true);?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 412:
What is the output of console.log(typeof {});?
A) object
B) array
C) null
D) undefined
Answer:
A) object
Question 413:
What will console.log([1, 2, 3].slice(1)); output?
A) [1]
B) [2, 3]
C) [1, 2]
D) error
Answer:
B) [2, 3]
Question 414:
Which of the following is not a primitive data type in JavaScript?
A) String
B) Number
C) Object
D) Boolean
Answer:
C) Object
Question 415:
Which method can be used to remove an element from an array by its value?
A) remove()
B) delete()
C) filter()
D) splice()
Answer:
C) filter()
Question 416:
What is the output of console.log('a' + 'b' + 'c');?
A) 'abc'
B) 'a b c'
C) error
D) undefined
Answer:
A) 'abc'
Question 417:
What will console.log([2] + [3]); output?
A) 5
B) '23'
C) [5]
D) error
Answer:
B) '23'
Question 418:
Which method can be used to find the index of an element in an array?
A) indexOf()
B) findIndex()
C) both A and B
D) None of the above
Answer:
C) both A and B
Question 419:
What does the `map()` method do in JavaScript?
A) Modifies the original array
B) Returns a new array with the results of calling a function on every element
C) Filters elements in an array
D) None of the above
Answer:
B) Returns a new array with the results of calling a function on every element
Question 420:
What will console.log(true + false); output?
A) 1
B) 0
C) true
D) false
Answer:
A) 1
Question 421:
Which operator is used for strict equality in JavaScript?
A) ==
B) ===
C) =
D) !==
Answer:
B) ===
Question 422:
What does JSON stand for?
A) JavaScript Object Notation
B) Java Source Object Notation
C) JavaScript Online Notation
D) None of the above
Answer:
A) JavaScript Object Notation
Question 423:
How do you write an array in JavaScript?
A) var colors = (1, 2, 3);
B) var colors = [1, 2, 3];
C) var colors = {1, 2, 3};
D) None of the above
Answer:
B) var colors = [1, 2, 3];
Question 424:
What will console.log(!!'false'); output?
A) true
B) false
C) 'false'
D) undefined
Answer:
A) true
Question 425:
What is the result of '5' + 1 - 1?
A) 5
B) 6
C) '51'
D) error
Answer:
C) '51'
Question 426:
What does the `reduce()` method do in JavaScript?
A) Reduces the size of the array
B) Applies a function against an accumulator and each element in the array
C) Filters elements in an array
D) None of the above
Answer:
B) Applies a function against an accumulator and each element in the array
Question 427:
What will console.log('5' - 1); output?
A) 4
B) '4'
C) 5
D) error
Answer:
A) 4
Question 428:
Which of the following is used to define a function in JavaScript?
A) function myFunction() { }
B) myFunction() = function { }
C) function:myFunction() { }
D) None of the above
Answer:
A) function myFunction() { }
Question 429:
What will console.log(1 + '1'); output?
A) 2
B) '11'
C) error
D) undefined
Answer:
B) '11'
Question 430:
What does the `filter()` method do in JavaScript?
A) Creates a new array with all elements that pass the test implemented by the provided function
B) Modifies the original array
C) Sorts the elements in an array
D) None of the above
Answer:
A) Creates a new array with all elements that pass the test implemented by the provided function
Question 431:
What is the output of console.log(null == undefined);?
A) true
B) false
C) error
D) undefined
Answer:
A) true
Question 432:
Which operator is used to assign a value to a variable in JavaScript?
A) =
B) ==
C) ===
D) !=
Answer:
A) =
Question 433:
What is the result of NaN === NaN?
A) true
B) false
C) error
D) undefined
Answer:
B) false
Question 434:
How do you create an object in JavaScript?
A) var obj = {};
B) var obj = new Object();
C) both A and B
D) None of the above
Answer:
C) both A and B
Question 435:
What is the output of console.log('5' == 5);?
A) true
B) false
C) error
D) undefined
Answer:
A) true
Question 436:
What will console.log(typeof NaN); output?
A) 'number'
B) 'NaN'
C) 'undefined'
D) 'object'
Answer:
A) 'number'
Question 437:
What does the `concat()` method do in JavaScript?
A) Merges two or more arrays
B) Splits a string into an array
C) Joins two or more strings
D) None of the above
Answer:
A) Merges two or more arrays
Question 438:
What is the output of console.log(typeof null);?
A) 'object'
B) 'null'
C) 'undefined'
D) 'number'
Answer:
A) 'object'
Question 439:
Which of the following is a primitive data type in JavaScript?
A) Object
B) Array
C) String
D) All of the above
Answer:
C) String
Question 440:
What does the `slice()` method do in JavaScript?
A) Extracts a section of an array and returns a new array
B) Removes the last element from an array
C) Joins two or more arrays
D) None of the above
Answer:
A) Extracts a section of an array and returns a new array
Question 441:
How do you create a function that returns a value in JavaScript?
A) function myFunction() { return value; }
B) function myFunction() { value; }
C) function myFunction() { return; }
D) None of the above
Answer:
A) function myFunction() { return value; }
Question 442:
What will console.log(typeof undefined); output?
A) 'undefined'
B) 'null'
C) 'object'
D) 'number'
Answer:
A) 'undefined'
Question 443:
What is the output of console.log('1' + '1');?
A) '2'
B) '11'
C) error
D) undefined
Answer:
B) '11'
Question 444:
What is a closure in JavaScript?
A) A function that has access to its own scope, the outer function's scope, and the global scope
B) A function that does not have access to the outer function's scope
C) A way to declare a variable
D) None of the above
Answer:
A) A function that has access to its own scope, the outer function's scope, and the global scope
Question 445:
What will console.log(0.1 + 0.2 == 0.3); output?
A) true
B) false
C) error
D) undefined
Answer:
B) false
Question 446:
How do you declare a variable in JavaScript?
A) var myVar;
B) let myVar;
C) const myVar;
D) All of the above
Answer:
D) All of the above
Question 447:
What is the output of console.log(typeof 123);?
A) 'string'
B) 'number'
C) 'undefined'
D) 'object'
Answer:
B) 'number'
Question 448:
What is the output of console.log(true + true);?
A) 2
B) true
C) false
D) NaN
Answer:
A) 2
Question 449:
What will console.log(1 == '1'); output?
A) true
B) false
C) error
D) undefined
Answer:
A) true
Question 450:
What is the difference between == and === in JavaScript?
A) == checks value and type; === checks only value
B) == checks only value; === checks value and type
C) Both are the same
D) None of the above
Answer:
B) == checks only value; === checks value and type
«
1
2
3
4
5
6
7
8
9
10
»
Showing 401-450 of 500 questions