JavaScript Quiz Online Free - 01 Click on the "Check Your Score" button to the result [Button given below] Question 1: Which of the following is not a valid JavaScript data type? string character number boolan Question 2: What is the result of typeof NaN? "number" "string" "NaN" "undefined" Question 3: Which keyword is used to declare a constant in JavaScript? var let static const Question 4: What is the correct way to comment a single line in JavaScript? -- This is a comment /* This is a comment */ // This is a comment ''' This is a comment ''' Question 5: How do you declare a function in JavaScript? var myFunction = function() let myFunction = () const function = myFunction() function myFunction() Question 6: What does the === operator do in JavaScript? Checks for equality, excluding data type Checks for strict equality, including data type Compares two strings Assigns a value to a variable Question 7: Which of the following is not a loop in JavaScript? if for while do...while Question 8: What is the purpose of the "Array.push()" method in JavaScript? Adds one or more elements to the end of an array Removes the last element from an array Sorts the elements in an array Reverses the order of elements in an array Question 9: What is the output of 2 + "2" in JavaScript? 4 22 "22" "4" Question 10: Which method is used to remove the last element from an array in JavaScript? push() shift() unshift() pop() Question 11: What does the "parseInt("3.14")"" function return in JavaScript? 3.14 3 "3.14" NaN Question 12: Which of the following is not a valid way to declare a variable in JavaScript? 1var myVar; var myVar; const myVar; let myVar; Question 13: What is the purpose of the setTimeout() function in JavaScript Sets a timer to repeat a function at a specified interval Delays the execution of a function for a specified number of milliseconds Measures the execution time of a function Clears a timer set by setTimeout() Question 14: How do you check the length of an array in JavaScript? Using the array.size property Using the length property Using the arrayLength property Using the array.length() method Question 15: Which operator is used to concatenate two strings in JavaScript? & + . , Question 16: What is the result of "5" - 3 in JavaScript? 2 "2" 52 "52" Question 17: What is the purpose of the Array.splice() method in JavaScript? Adds elements to the beginning of an array Sorts the elements in an array Reverses the order of elements in an array Removes elements from an array and replaces them with new elements Question 18: Which of the following is not a valid way to declare an object in JavaScript? { key: "value" } new Object() "object"() Object.create({}) Question 19: What is the correct way to check if a variable is an array in JavaScript? Array.isArray(variable) typeof variable === "array" variable instanceof Array variable.isArray() Question 20: What does the Array.join() method do in JavaScript? Removes the first element from an array Returns the first element of an array Joins two arrays together Combines all elements of an array into a string with a specified separator