WorksheetsJavaScript Quiz
Total questions: 20
Worksheet time: 11mins
Which keyword is used to declare a variable in JavaScript?
let
const
var
All of the above
Which of the following is NOT a valid JavaScript data type?
String
Boolean
Number
Object
What is the result of the following code: "5" + 5?
10
"55"
"10"
NaN
What does the acronym "JSON" stand for in JavaScript?
JavaScript Object Notation
Java Script Output Note
JavaScript Object Namespace
Java Script On-The-Go
What does the "NaN" value represent in JavaScript?
"New and Nice" value
"Not a Number" value
"No Available Number" value
"Never Again" value
Which of the following is a valid way to declare a variable in JavaScript?
let myVar;
const myVar;
myVar;
var myVar;
Which of the following loop statements will always execute at least once?
for loop
while loop
do-while loop
All of the above
Which keyword is used to define a function in JavaScript?
Def
Function
Create
Define
Which of the following is NOT a comparison operator in JavaScript?
<
>
=
==
Which of the following is NOT a valid way to create an array in JavaScript?
let myArray = [1, 2, 3];
let myArray = new Array(1, 2, 3);
let myArray = 1, 2, 3;
None of the above
Which of the following is NOT a logical operator in JavaScript?
&&
||
!
#
Which of the following is NOT a valid way to declare a JavaScript function?
myFunction = () => {};
function myFunction() {}
let myFunction = function() {};
All of the above are valid
Which of the following is the correct way to add a new element to the end of an array in JavaScript?
array.add("newElement");
array.push("newElement");
array.concat("newElement");
array.append("newElement");
What is the difference between "==" and "===" in JavaScript?
"==" compares values and types, while "===" only compares values.
"==" and "===" are interchangeable.
There is no difference between "==" and "===".
"===" compares values and types, while "==" only compares values.
Which of the following is NOT a valid way to execute a function in JavaScript?
myFunction();
myFunction.call();
myFunction.apply(); (Answer)
All of the above are valid
Which of the following is the correct way to remove the last element from an array in JavaScript?
array.slice(-1);
array.splice(-1);
array.removeLast();
array.pop();
Which of the following is NOT a valid way to write a conditional statement in JavaScript?
if (x > 5) {}
switch (x) {}
for (x in array) {}
All of the above are valid
What is the result of the following code: Math.floor(4.6);
(a)
The (a) method in JavaScript adds a new element to the beginning of an array.
Which of the following is NOT a valid way to declare a constant in JavaScript?
const myConstant = "value";
let myConstant = "value";
var myConstant = "value";
All of the above are constant
