JavaScript Basics Quiz

Create an account and save your quiz results

Login and save your results

OR

Question 1/15

What method is used to add new elements to the end of an array?

Select your answer

Question 2/15

What will the following expression return: Boolean(0);
Boolean(0);

Select your answer

Question 3/15

Which method can be used to convert a JSON string into a JavaScript object?

Select your answer

Question 4/15

What will the value of "x" be after the code is run?
let x = 5;
x = x * 2;

Select your answer

Question 5/15

Which company developed JavaScript?

Select your answer

Question 6/15

Which of the following data types exists in JavaScript?

Select your answer

Question 7/15

How do you round 7.25 to the nearest integer in JavaScript?
Math.round(7.25);

Select your answer

Question 8/15

Which operator is used to assign a value to a variable?

Select your answer

Question 9/15

What will the following code output?
var fruits = ['Apple', 'Banana', 'Mango'];
console.log(fruits[1]);

Select your answer

Question 10/15

Which one of these is an Arrow Function syntax?

Select your answer

Question 11/15

How do you find the number with the highest value of x and y?
Math.max(x, y);

Select your answer

Question 12/15

What is the correct way to declare a variable in JavaScript?

Select your answer

Question 13/15

What is a typical use case for the "isNaN()" function?

Select your answer

Question 14/15

What is the output when you execute the following code?
console.log(typeof 42);

Select your answer

Question 15/15

How do you write an "if" statement in JavaScript to execute some code if "i" is equal to 5?
if (i === 5) {
    // code to execute
}

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
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 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
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 4/15
😊 Your answer was correct 🙁 Your answer was incorrect
What will the value of "x" be after the code is run?
let x = 5;
x = x * 2;

Available answers

The operation
x = x * 2
assigns the result of
5 * 2
to
x
, which is
10
.
Question 5/15
😊 Your answer was correct 🙁 Your answer was incorrect
Which company developed JavaScript?

Available answers

JavaScript was developed by Netscape as a client-side scripting language.
Question 6/15
😊 Your answer was correct 🙁 Your answer was incorrect
Which of the following data types exists in JavaScript?

Available answers

JavaScript supports data types such as
String, Number, Boolean, Object
, but not specific types like
Character
or
Tuple
.
Question 7/15
😊 Your answer was correct 🙁 Your answer was incorrect
How do you round 7.25 to the nearest integer in JavaScript?
Math.round(7.25);

Available answers

To round a number in JavaScript, use
Math.round()
.
Question 8/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 9/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 10/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 11/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 12/15
😊 Your answer was correct 🙁 Your answer was incorrect
What is the correct way to declare a variable in JavaScript?

Available answers

In JavaScript, you declare a variable using the
var
,
let
, or
const
keyword, such as
var myVariable;
.
Question 13/15
😊 Your answer was correct 🙁 Your answer was incorrect
What is a typical use case for the "isNaN()" function?

Available answers

The
isNaN()
function checks if a value is NaN (Not-a-Number).
Question 14/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 15/15
😊 Your answer was correct 🙁 Your answer was incorrect
How do you write an "if" statement in JavaScript to execute some code if "i" is equal to 5?
if (i === 5) {
    // code to execute
}

Available answers

The syntax for an "if" statement in JavaScript to check for equality is:
if (i === 5) { /* code */ }
.