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
Web Development Training in Chandigarh
Web Development Training in Gurgaon
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 351:
What is the output of console.log(!!'');?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 352:
Which of the following statements is used to create a function in JavaScript?
A) function myFunction() {}
B) def myFunction() {}
C) create myFunction() {}
D) func myFunction() {}
Answer:
A) function myFunction() {}
Question 353:
What does the Math.random() function return?
A) A random integer
B) A random decimal between 0 and 1
C) A random number between 1 and 10
D) None of the above
Answer:
B) A random decimal between 0 and 1
Question 354:
What will console.log('foo' === new String('foo')); output?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 355:
Which of the following is a valid way to create a promise in JavaScript?
A) new Promise()
B) Promise.resolve()
C) Promise.all()
D) All of the above
Answer:
D) All of the above
Question 356:
What is the output of console.log(5 + '5');?
A) 10
B) 55
C) undefined
D) error
Answer:
B) 55
Question 357:
Which method can be used to convert a string to a number?
A) Number()
B) parseFloat()
C) parseInt()
D) All of the above
Answer:
D) All of the above
Question 358:
What is the output of console.log(null === undefined);?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 359:
Which of the following is used to stop the execution of a function?
A) break
B) return
C) continue
D) stop
Answer:
B) return
Question 360:
What will console.log(typeof function(){}); output?
A) function
B) object
C) undefined
D) error
Answer:
A) function
Question 361:
Which of the following is not a valid way to check for equality?
A) ===
B) ==
C) !=
D) ==!
Answer:
D) ==!
Question 362:
What is the output of console.log([1, 2, 3].pop());?
A) 1
B) 3
C) undefined
D) error
Answer:
B) 3
Question 363:
Which method is used to join two or more arrays?
A) concat()
B) join()
C) merge()
D) combine()
Answer:
A) concat()
Question 364:
What is the output of console.log('1' + 2 + 3);?
A) 6
B) 123
C) 15
D) error
Answer:
B) 123
Question 365:
Which of the following is a correct way to write an anonymous function?
A) function() {}
B) let func = function() {}
C) const func = function() {}
D) All of the above
Answer:
D) All of the above
Question 366:
Which method can be used to find the index of an element in an array?
A) findIndex()
B) indexOf()
C) search()
D) Both A and B
Answer:
D) Both A and B
Question 367:
What will console.log(typeof {}); output?
A) object
B) array
C) function
D) undefined
Answer:
A) object
Question 368:
What is the output of console.log(1 + '1');?
A) 2
B) 11
C) '11'
D) error
Answer:
C) '11'
Question 369:
What is the output of console.log('hello'.charAt(0));?
A) h
B) hello
C) e
D) error
Answer:
A) h
Question 370:
Which of the following is the correct syntax for creating 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 371:
What will console.log([1, 2, 3].shift()); output?
A) 1
B) 3
C) undefined
D) error
Answer:
A) 1
Question 372:
Which method can be used to convert a string to lowercase?
A) toLowerCase()
B) lowerCase()
C) lowercase()
D) None of the above
Answer:
A) toLowerCase()
Question 373:
What is the output of console.log('10' - 1);?
A) 11
B) 9
C) '9'
D) error
Answer:
B) 9
Question 374:
Which operator is used to assign a value to a variable?
A) -
B) =
C) :
D) *
Answer:
B) =
Question 375:
What is the output of console.log([2] == [2]);?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 376:
Which of the following is a way to define a function in JavaScript?
A) function myFunction() {}
B) const myFunction = () => {};
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 377:
What is the output of console.log(0 == '0');?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 378:
Which of the following is the correct way to create an array in JavaScript?
A) let arr = [];
B) let arr = new Array();
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 379:
What is the output of console.log([1, 2] == [1, 2]);?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 380:
What is the output of console.log('2' + 2);?
A) 4
B) '22'
C) 22
D) error
Answer:
B) '22'
Question 381:
What will console.log(typeof NaN); output?
A) number
B) NaN
C) undefined
D) error
Answer:
A) number
Question 382:
What is the output of console.log(true + false);?
A) true
B) false
C) 1
D) NaN
Answer:
C) 1
Question 383:
Which of the following is a falsy value in JavaScript?
A) 0
B) null
C) undefined
D) All of the above
Answer:
D) All of the above
Question 384:
What will console.log(2 === '2'); output?
A) true
B) false
C) undefined
D) error
Answer:
B) false
Question 385:
Which of the following is the correct way to 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 386:
What is the output of console.log(typeof null);?
A) object
B) null
C) undefined
D) error
Answer:
A) object
Question 387:
What will console.log('5' + 5); output?
A) '55'
B) 10
C) '10'
D) error
Answer:
A) '55'
Question 388:
Which of the following is the result of console.log(typeof []);?
A) array
B) object
C) undefined
D) error
Answer:
B) object
Question 389:
What will console.log(5 + '5'); output?
A) 10
B) '55'
C) 5
D) error
Answer:
B) '55'
Question 390:
Which of the following is not a primitive data type in JavaScript?
A) String
B) Object
C) Number
D) Boolean
Answer:
B) Object
Question 391:
What will console.log([1, 2, 3].pop()); output?
A) 3
B) [1, 2]
C) 1
D) error
Answer:
A) 3
Question 392:
Which of the following is the correct way to concatenate two strings in JavaScript?
A) str1 + str2
B) str1.concat(str2)
C) Both A and B
D) None of the above
Answer:
C) Both A and B
Question 393:
What will console.log('Hello'.charAt(0)); output?
A) 'H'
B) 'Hello'
C) 'e'
D) error
Answer:
A) 'H'
Question 394:
What is the output of console.log(1 + '1');?
A) 2
B) '11'
C) '1'
D) error
Answer:
B) '11'
Question 395:
Which method is used to remove the last element from an array in JavaScript?
A) pop()
B) delete()
C) shift()
D) remove()
Answer:
A) pop()
Question 396:
What will console.log(typeof undefined); output?
A) undefined
B) object
C) function
D) error
Answer:
A) undefined
Question 397:
What will console.log('a' > 'A'); output?
A) true
B) false
C) NaN
D) error
Answer:
A) true
Question 398:
Which operator is used for strict equality in JavaScript?
A) =
B) ==
C) ===
D) !==
Answer:
C) ===
Question 399:
What is the output of console.log([1] == true);?
A) true
B) false
C) undefined
D) error
Answer:
A) true
Question 400:
Which of the following methods can be used to convert a string to a number in JavaScript?
A) parseInt()
B) Number()
C) parseFloat()
D) All of the above
Answer:
D) All of the above
«
1
2
3
4
5
6
7
8
9
10
»
Showing 351-400 of 500 questions