Test your knowledge of JavaScript programming concepts with this comprehensive quiz covering basic to advanced topics.
1. What is JavaScript primarily used for?
2. How do you write "Hello World" in an alert box?
3. How do you declare a variable in JavaScript?
4. Which operator is used for strict equality in JavaScript?
5. What will this code output? console.log(typeof 42);
console.log(typeof 42);
6. How do you create a function in JavaScript?
7. Which method removes the last element from an array?
8. What does the "this" keyword refer to in JavaScript?
9. What is the correct way to write an IF statement in JavaScript?
10. How do you add a comment in JavaScript?
11. Which event occurs when the user clicks on an HTML element?
12. How do you round the number 7.25 to the nearest integer?
// How to round 7.25 to the nearest integer? Math.?(7.25);
13. What will this code return? Boolean(10 > 9)
Boolean(10 > 9);
14. Which operator is used to concatenate strings in JavaScript?
15. What is the correct way to create a JavaScript array?
16. How do you find the length of a string in JavaScript?
17. What will this code output? console.log(2 + "2");
console.log(2 + "2");
18. Which keyword is used to declare a constant in JavaScript?
19. What does the Array.map() method do?
20. What is the purpose of the "use strict" directive?
"use strict"; // JavaScript code here