JavaScript MCQ Test: JavaScript MCQs - Practice Questions
1. What is the purpose of the 'fetch' function in JavaScript?
2. How do you define a JavaScript class?
3. What is the purpose of 'document.getElementById()' in JavaScript?
4. What is the result of the expression '3 * '2' + 1' in JavaScript?
5. How do you comment a single line in JavaScript?
6. What does HTML stand for?
7. What is the purpose of 'localStorage' in JavaScript?
8. How do you create a class in JavaScript?
9. How do you round the number 7.25 to the nearest integer in JavaScript?
10. What does CSS stand for?
11. Which method is used to add an element to the end of an array in JavaScript?
12. What is the purpose of 'Array.prototype.reduce()' in JavaScript?
13. What is the purpose of 'Array.isArray()' in JavaScript?
14. What is the purpose of the 'querySelector' method in JavaScript?
15. Which of the following is a benefit of using JavaScript modules?
16. What is the purpose of 'Array.prototype.map()' in JavaScript?
17. Which method is used to convert a string to uppercase in JavaScript?
18. How do you write a multi-line comment in JavaScript?
19. Which statement is used to exit a switch statement in JavaScript?
20. Which operator is used for strict equality in JavaScript?
21. How do you write an IF statement in JavaScript?
22. What is the purpose of the 'addEventListener()' method in JavaScript?
23. Which of the following is a valid way to declare a JavaScript array?
24. What is the purpose of 'console.log()' in JavaScript?
25. What is the result of the expression '2 + 2' in JavaScript?
26. How do you declare a variable in JavaScript?
27. What is the purpose of the 'Math.random()' function in JavaScript?
28. Which method is used to remove the last element from an array in JavaScript?
29. What is the purpose of the 'async' keyword in JavaScript?
30. What is the purpose of the 'reduce' method in JavaScript?
31. How do you create a comment in JavaScript?
32. What is the purpose of the 'localStorage' object in JavaScript?
33. Which method is used to add a class to an HTML element in JavaScript?
34. Which of the following is a falsy value in JavaScript?
35. What is the purpose of the 'setTimeout' function in JavaScript?
36. How do you check if an element has a specific class in JavaScript?
37. Which operator is used to concatenate strings in JavaScript?
38. How do you create an object in JavaScript?
39. Which method is used to remove the last element from an array in JavaScript?
40. How do you comment in JavaScript?
41. What is a closure in JavaScript?
42. What is the purpose of 'Array.prototype.filter()' in JavaScript?
43. What is the purpose of 'setTimeout()' in JavaScript?
44. What is the purpose of the 'bind' method in JavaScript?
45. Which method is used to join elements of an array into a string in JavaScript?
46. Which function is used to parse a JSON string in JavaScript?
47. What is the result of the expression '2' + 2 in JavaScript?
48. How do you declare a variable in JavaScript?
49. What is the purpose of 'Promise' in JavaScript?
50. What is the purpose of the 'map' function in JavaScript?