JavaScript MCQ Test: JavaScript MCQs - Practice Questions
1. What is the purpose of the 'Math.random()' function in JavaScript?
2. How do you declare a variable in JavaScript?
3. How do you comment in JavaScript?
4. How do you check if an element has a specific class in JavaScript?
5. What is the purpose of the 'localStorage' object in JavaScript?
6. Which of the following is a valid way to declare a JavaScript array?
7. Which method is used to add a class to an HTML element in JavaScript?
8. What is the purpose of 'setTimeout()' in JavaScript?
9. Which method is used to join elements of an array into a string in JavaScript?
10. How do you declare a variable in JavaScript?
11. What is the purpose of 'Promise' in JavaScript?
12. Which of the following is a benefit of using JavaScript modules?
13. Which of the following is not a JavaScript data type?
14. What is the purpose of the 'querySelector' method in JavaScript?
15. Which statement is used to exit a switch statement in JavaScript?
16. What is the result of the expression '2' + 2 in JavaScript?
17. What is the purpose of 'console.log()' in JavaScript?
18. What does CSS stand for?
19. What is the purpose of the 'async' keyword in JavaScript?
20. Which function is used to parse a JSON string in JavaScript?