NEW
Font size
WorksheetsJavaScript Quiz
Total questions: 20
Worksheet time: 7mins
Which type of JavaScript language is ___
Object-Oriented
Object-Based
Assembly-language
High-level
What is the purpose of the 'this' keyword in JavaScript?
To refer to the current object
To declare a variable
To create a loop
To import external libraries
What does the 'typeof' operator in JavaScript return?
The data type of a variable
The value of a variable
The length of a string
The index of an array element
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
What is the purpose of the 'let' keyword in JavaScript?
To declare a block-scoped variable
To refer to the current object
To create a loop
To import external libraries
What does the 'NaN' value represent in JavaScript?
Not a Number
Null
Undefined
Infinity
Which method is used to add a new element to the end of an array in JavaScript?
push()
pop()
shift()
unshift()
What is the purpose of the 'forEach' method in JavaScript?
To iterate over the elements of an array
To add a new element to the end of an array
To remove the first element of an array
To check if an element exists in an array
What is the correct way to declare a constant variable in JavaScript?
const myVar = 10;
let myVar = 10;
var myVar = 10;
constant myVar = 10;
What does the '=== ' operator in JavaScript compare?
Value and type
Value only
Type only
Reference in memory
What is the purpose of the 'map' method in JavaScript?
To transform each element of an array
To add a new element to the end of an array
To remove the first element of an array
To check if an element exists in an array
What does the 'filter' method do in JavaScript?
Creates a new array with elements that pass a test
Sorts the elements of an array
Reverses the order of elements in an array
Concatenates two arrays
How can you access the last element of an array in JavaScript?
By using the index of the last element
By using the 'last' keyword
By using the 'end' keyword
By using the 'length' property of the array
varx=5,y=1
var obj ={ x:10}
with(obj)
{
alert(y)
}
1
error
10
5
What is the purpose of the 'reduce' method in JavaScript?
To reduce the array to a single value
To add a new element to the end of an array
To remove the first element of an array
To check if an element exists in an array
What is the purpose of the 'find' method in JavaScript?
To find the first element in an array that satisfies a condition
To add a new element to the end of an array
To remove the first element of an array
To check if an element exists in an array
What is the purpose of the 'some' method in JavaScript?
To check if at least one element in an array satisfies a condition
To add a new element to the end of an array
To remove the first element of an array
To check if an element exists in an array
What is the purpose of the 'slice' method in JavaScript?
To extract a section of an array
To add a new element to the end of an array
To remove the first element of an array
To check if an element exists in an array
What does the 'concat' method do in JavaScript?
Combines two or more arrays
Sorts the elements of an array
Reverses the order of elements in an array
Filters elements based on a condition
What is the purpose of the 'findIndex' method in JavaScript?
To find the index of the first element in an array that satisfies a condition
To add a new element to the end of an array
To remove the first element of an array
To check if an element exists in an array
