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
How can you add a comment in JavaScript?
Select your answer
Question 2/15
What does "const" declare in JavaScript?
Select your answer
Question 3/15
What method is used to add new elements to the end of an array?
Select your answer
Question 4/15
Which one of these is an Arrow Function syntax?
Select your answer
Question 5/15
What is the correct syntax for referring to an external JavaScript file called 'app.js'?
Select your answer
Question 6/15
Which of the following will write "Hello World!" to the console?
Select your answer
Question 7/15
Which method can be used to convert a JSON string into a JavaScript object?
Select your answer
Question 8/15
Which of the following is a string method in JavaScript?
Select your answer
Question 9/15
What does "NaN" stand for in JavaScript?
Select your answer
Question 10/15
What is the output when you execute the following code?
console.log(typeof 42);
Select your answer
Question 11/15
When the following code is executed, what will the value of the expression be?
3 == '3'
Select your answer
Question 12/15
What will the following code output?
var fruits = ['Apple', 'Banana', 'Mango'];
console.log(fruits[1]);
Select your answer
Question 13/15
Which of the following data types exists in JavaScript?
Select your answer
Question 14/15
What will the following expression return: Boolean(0);
Boolean(0);
Select your answer
Question 15/15
What is a typical use case for the "isNaN()" function?
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
How can you add a comment in JavaScript?
Available answers
In JavaScript, comments start with
//
for single-line comments or /* ... */
for multi-line comments.
Question 2/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 3/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 4/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 5/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What is the correct syntax for referring to an external JavaScript file called 'app.js'?
Available answers
To include an external JavaScript file, you use the
<script src='app.js'></script>
syntax.
Question 6/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which of the following will write "Hello World!" to the console?
Available answers
The function
console.log()
is used to output messages to the web console in JavaScript.
Question 7/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 8/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
Which of the following is a string method in JavaScript?
Available answers
The
toUpperCase()
method converts a string to uppercase letters.
Question 9/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.
Question 10/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 11/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 12/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 13/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 14/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 15/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).