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 451:
What will console.log(typeof []); output?
A) 'array'
B) 'object'
C) 'undefined'
D) 'null'
Answer:
B) 'object'
Question 452:
What is the output of console.log('Hello' + 5);?
A) 'Hello5'
B) 'Hello 5'
C) 'Hello' + 5
D) error
Answer:
A) 'Hello5'
Question 453:
Which of the following is a primitive data type in JavaScript?
A) Object
B) Array
C) String
D) Function
Answer:
C) String
Question 454:
What will console.log(1 + '1' - 1); output?
A) 1
B) 2
C) '10'
D) error
Answer:
A) 1
Question 455:
What does the "use strict" directive do in JavaScript?
A) It allows you to use reserved keywords.
B) It enables strict mode which helps to write secure JavaScript.
C) It has no effect on the code.
D) It prevents the use of variables.
Answer:
B) It enables strict mode which helps to write secure JavaScript.
Question 456:
What is the output of console.log('abc'.length);?
A) 3
B) 'abc'
C) undefined
D) error
Answer:
A) 3
Question 457:
What will console.log(!!'Hello'); output?
A) true
B) false
C) NaN
D) undefined
Answer:
A) true
Question 458:
What is the output of console.log(NaN === NaN);?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 459:
What is the result of the following operation: '5' + 5 - 5?
A) 5
B) 55
C) '55'
D) error
Answer:
A) 5
Question 460:
Which function can be used to parse a JSON string?
A) JSON.parse()
B) JSON.stringify()
C) JSON.toObject()
D) JSON.convert()
Answer:
A) JSON.parse()
Question 461:
What does the Array.isArray() method do?
A) Checks if the object is an array
B) Converts an array to a string
C) Joins two arrays
D) Sorts the array
Answer:
A) Checks if the object is an array
Question 462:
What is the output of console.log('1' + -1);?
A) '0'
B) '1-1'
C) '10'
D) error
Answer:
C) '0'
Question 463:
Which of the following is used to declare a variable in JavaScript?
A) var
B) let
C) const
D) All of the above
Answer:
D) All of the above
Question 464:
What is the output of console.log('Hello' + 'World');?
A) HelloWorld
B) 'Hello World'
C) error
D) undefined
Answer:
A) HelloWorld
Question 465:
Which method can be used to convert a string to a number?
A) Number()
B) parseInt()
C) parseFloat()
D) All of the above
Answer:
D) All of the above
Question 466:
What will console.log(0 === '0'); output?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 467:
Which operator is used to compare two values for equality in JavaScript?
A) =
B) ==
C) ===
D) Both B and C
Answer:
D) Both B and C
Question 468:
What is the output of console.log(undefined == null);?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 469:
What is the result of the following operation: [] + {}?
A) '[object Object]'
B) '[]'
C) error
D) undefined
Answer:
A) '[object Object]'
Question 470:
Which built-in method combines the text of two strings and returns a new string?
A) append()
B) concat()
C) attach()
D) join()
Answer:
B) concat()
Question 471:
What is the output of console.log(1 == '1');?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 472:
Which of the following is NOT a JavaScript data type?
A) Undefined
B) String
C) Boolean
D) Character
Answer:
D) Character
Question 473:
What will console.log(typeof NaN); output?
A) 'number'
B) 'undefined'
C) 'NaN'
D) error
Answer:
A) 'number'
Question 474:
Which keyword is used to define a variable in JavaScript?
A) var
B) let
C) const
D) All of the above
Answer:
D) All of the above
Question 475:
What is the output of console.log(1 + '1');?
A) 2
B) '11'
C) '1'
D) error
Answer:
B) '11'
Question 476:
Which operator is used for division in JavaScript?
A) /
B) %
C) *
D) -
Answer:
A) /
Question 477:
What is the result of the following operation: 3 + 2 + '1'?
A) 51
B) 6
C) 5
D) error
Answer:
A) 51
Question 478:
Which of the following is used to create an array in JavaScript?
A) []
B) {}
C) ()
D) None of the above
Answer:
A) []
Question 479:
What will be the output of console.log(1 + '2' - '1');?
A) 2
B) '12'
C) 1
D) error
Answer:
A) 2
Question 480:
Which function is used to find the length of a string in JavaScript?
A) length()
B) size()
C) str.length
D) getLength()
Answer:
C) str.length
Question 481:
What will be the output of console.log(2 ** 3);?
A) 6
B) 8
C) 9
D) error
Answer:
B) 8
Question 482:
What does the 'this' keyword refer to in JavaScript?
A) The global object
B) The current function
C) The current object
D) None of the above
Answer:
C) The current object
Question 483:
Which method is used to convert a JSON string into a JavaScript object?
A) JSON.stringify()
B) JSON.parse()
C) JSON.toObject()
D) None of the above
Answer:
B) JSON.parse()
Question 484:
Which operator is used to check for both value and type in JavaScript?
A) =
B) ==
C) ===
D) !=
Answer:
C) ===
Question 485:
What will be the output of console.log(false + 1);?
A) 1
B) false
C) 0
D) error
Answer:
A) 1
Question 486:
Which of the following is a way to create an object in JavaScript?
A) object = {};
B) object = new Object();
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 487:
What does the Array.isArray() method do?
A) Checks if an object is an array
B) Creates a new array
C) Converts an array to a string
D) None of the above
Answer:
A) Checks if an object is an array
Question 488:
What is the output of console.log(0.1 + 0.2 == 0.3);?
A) true
B) false
C) NaN
D) error
Answer:
B) false
Question 489:
Which of the following is a valid way to define a function in JavaScript?
A) function myFunction() {}
B) var myFunction = function() {};
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 490:
What is the purpose of the 'use strict' statement in JavaScript?
A) To enable strict mode
B) To disable strict mode
C) To optimize code
D) None of the above
Answer:
A) To enable strict mode
Question 491:
Which method is used to remove the last element from an array in JavaScript?
A) pop()
B) shift()
C) delete()
D) remove()
Answer:
A) pop()
Question 492:
What is the result of the following code: console.log(typeof NaN);?
A) 'number'
B) 'NaN'
C) 'undefined'
D) error
Answer:
A) 'number'
Question 493:
Which of the following is used to prevent the default action of an event in JavaScript?
A) event.preventDefault()
B) event.stopPropagation()
C) Both A and B
D) None of the above
Answer:
A) event.preventDefault()
Question 494:
What will be the output of console.log(typeof null);?
A) 'null'
B) 'object'
C) 'undefined'
D) error
Answer:
B) 'object'
Question 495:
Which method is used to add one or more elements to the end of an array in JavaScript?
A) push()
B) unshift()
C) add()
D) append()
Answer:
A) push()
Question 496:
What does NaN stand for in JavaScript?
A) Not a Number
B) Not available
C) Not an Object
D) None of the above
Answer:
A) Not a Number
Question 497:
Which method is used to combine two or more arrays in JavaScript?
A) concat()
B) join()
C) merge()
D) append()
Answer:
A) concat()
Question 498:
Which of the following is NOT a primitive data type in JavaScript?
A) String
B) Number
C) Object
D) Boolean
Answer:
C) Object
Question 499:
What will be the output of the following code: console.log('5' + 3);?
A) '53'
B) 8
C) '8'
D) error
Answer:
A) '53'
Question 500:
What does the 'window' object represent in JavaScript?
A) The browser window
B) The current document
C) The global scope
D) All of the above
Answer:
D) All of the above
«
1
2
3
4
5
6
7
8
9
10
Showing 451-500 of 500 questions