Web Quiz
1. Which keyword is used to declare a variable in JavaScript?
A. var
B. let
C. const
D. All of the above
Submit
2. How do you create a function in JavaScript?
A. function myFunction() {}
B. function myFunction() {}
C. createFunction myFunction()
D. myFunction() {}
Submit
3. What does the `typeof` operator do in JavaScript?
A. Determines the type of an element in the DOM
B. Returns a string indicating the type of a variable
C. Converts a variable to a specific type
D. Defines a new data type
Submit
4. How do you write a single-line comment in JavaScript?
A. // This is a comment
B. /* This is a comment */
C. -- This is a comment
D. <!-- This is a comment -->
Submit
5. Which method is used to convert a string to a number in JavaScript?
A. parseInt()
B. toNumber()
C. Number()
D. convertToNumber()
Submit
6. What does `NaN` stand for in JavaScript?
A. Not a Number
B. Not a Number
C. No available Number
D. Null and Not
Submit
7. How do you check if a variable is an array in JavaScript?
A. Array.isArray()
B. Array.isArray()
C. isArray()
D. variable instanceof Array
Submit
8. How do you create an object in JavaScript?
A. var obj = {};
B. var obj = {};
C. var obj = new Object();
D. var obj = new Array();
Submit
9. What will the following code return: `typeof(null)`?
A. object
B. null
C. undefined
D. NaN
Submit
10. How do you access the first element in an array?
A. array[0]
B. array[1]
C. array.first()
D. array.firstElement()
Submit
Back To Home
Score