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 do you call a method named "calculate" of an object named "mathObj"?
Select your answer
Question 2/15
What method is used to add new elements to the end of an array?
Select your answer
Question 3/15
What is the correct syntax for referring to an external JavaScript file called 'app.js'?
Select your answer
Question 4/15
What will the following function return?
function myFunction() {
return 5 + 3;
}
Select your answer
Question 5/15
Which operator is used to assign a value to a variable?
Select your answer
Question 6/15
What is the correct way to declare a variable in JavaScript?
Select your answer
Question 7/15
What is a typical use case for the "isNaN()" function?
Select your answer
Question 8/15
Which company developed JavaScript?
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
What is the output when you execute the following code?
console.log(typeof 42);
Select your answer
Question 11/15
Which of the following data types exists in JavaScript?
Select your answer
Question 12/15
Which of these is not a reserved word in JavaScript?
Select your answer
Question 13/15
Which one of these is an Arrow Function syntax?
Select your answer
Question 14/15
How do you create a function in JavaScript?
function myFunction() {
// code here
}
Select your answer
Question 15/15
Which of the following is a string method 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
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 2/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 3/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 4/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
What will the following function return?
function myFunction() {
return 5 + 3;
}
Available answers
The function calculates
5 + 3
and returns 8
.
Question 5/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 6/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 7/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 8/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 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
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
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 12/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 13/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 14/15
😊 Your
answer was correct
🙁 Your
answer was incorrect
How do you create a function in JavaScript?
function myFunction() {
// code here
}
Available answers
To define a function in JavaScript, use the syntax:
function myFunction() { /* code */ }
.
Question 15/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.