JavaScript Basics Quiz
Want to learn more than this quiz offers you? Have a look at my Frontend web
development courses.
Create an account and save your quiz results
Login and save your results
OR
Question 1/15
Which operator is used to assign a value to a variable?
Select your answer
Question 2/15
What will the following expression return: Boolean(0);
Boolean(0);
Select your answer
Question 3/15
When the following code is executed, what will the value of the expression be?
3 == '3'
Select your answer
Question 4/15
Which of these is not a reserved word in JavaScript?
Select your answer
Question 5/15
What does the "alert()" function do in JavaScript?
Select your answer
Question 6/15
How do you find the number with the highest value of x and y?
Math.max(x, y);
Select your answer
Question 7/15
What is the output of the following JavaScript code?
var x = 10;
x += 5;
console.log(x);
Select your answer
Question 8/15
What method is used to add new elements to the end of an array?
Select your answer
Question 9/15
Which one of these is an Arrow Function syntax?
Select your answer
Question 10/15
How do you call a method named "calculate" of an object named "mathObj"?
Select your answer
Question 11/15
What is the output when you execute the following code?
console.log(typeof 42);
Select your answer
Question 12/15
Which method can be used to convert a JSON string into a JavaScript object?
Select your answer
Question 13/15
What does "const" declare in JavaScript?
Select your answer
Question 14/15
What will the following code output?
var fruits = ['Apple', 'Banana', 'Mango'];
console.log(fruits[1]);
Select your answer
Question 15/15
What does "NaN" stand for in JavaScript?
Select your answer
Your Results
You did not answer any questions correctly.
Your Answers
Question 1/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which operator is used to assign a value to a variable?
Available answers
The assignment operator in JavaScript is
=
, used to assign values to variables.
Question 2/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What will the following expression return: Boolean(0);
Boolean(0);
Available answers
The expression
Boolean(0)
returns false
because 0
is considered a "falsy" value in JavaScript.
Question 3/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
When the following code is executed, what will the value of the expression be?
3 == '3'
Available answers
The
==
operator checks for equality with type coercion. Hence 3 == '3'
is true
.
Question 4/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which of these is not a reserved word in JavaScript?
Available answers
The word
program
is not a reserved keyword in JavaScript, unlike switch, throw, default
.
Question 5/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What does the "alert()" function do in JavaScript?
Available answers
The
alert()
function displays an alert box containing a specified message and an OK button.
Question 6/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
How do you find the number with the highest value of x and y?
Math.max(x, y);
Available answers
The function
Math.max()
is used to find the highest value among its parameters.
Question 7/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What is the output of the following JavaScript code?
var x = 10;
x += 5;
console.log(x);
Available answers
The code uses
+=
to add 5
to x
, giving 15
.
Question 8/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What method is used to add new elements to the end of an array?
Available answers
The
push()
method adds one or more elements to the end of an array.
Question 9/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which one of these is an Arrow Function syntax?
Available answers
An Arrow Function does not use the
function
keyword and looks like (x, y) => x + y
.
Question 10/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
How do you call a method named "calculate" of an object named "mathObj"?
Available answers
Methods of objects are called using the dot notation:
object.method()
.
Question 11/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What is the output when you execute the following code?
console.log(typeof 42);
Available answers
The
typeof
operator returns 'number'
for numerical literals like 42
.
Question 12/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which method can be used to convert a JSON string into a JavaScript object?
Available answers
The
JSON.parse()
method is used to convert a JSON string into a JavaScript object.
Question 13/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What does "const" declare in JavaScript?
Available answers
const
declares a variable that is read-only after initialization, meaning it cannot be reassigned.
Question 14/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What will the following code output?
var fruits = ['Apple', 'Banana', 'Mango'];
console.log(fruits[1]);
Available answers
Arrays in JavaScript are zero-indexed, so
fruits[1]
contains 'Banana'
.
Question 15/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What does "NaN" stand for in JavaScript?
Available answers
NaN
stands for "Not-a-Number", indicating a value that is not a legal number.