NEW
Font size
WorksheetsJavaScript Basics Quiz
Total questions: 9
Worksheet time: 5mins
Which method is used to display data in the console?
log.console()
console.log()
console.display()
log()
How can you create a loop that executes five times?
for (let i = 1; i <= 5; i++) {}
for (i = 0; i < 5; i + 1) {}
foreach (let i in 5) {}
while (i < 5) { i++; }
What does Math.random() do?
Generates a random integer
Generates a random boolean
Generates a random decimal number between 0 and 1
Generates a random string
What is the output of typeof NaN?
"number"
"undefined"
"NaN"
"null"
What will the following code output: console.log(12 % 5)?
2
7
5
0
How do you declare a constant variable in ?
const myVar;
let myVar;
var myVar;
const myVar = value;
What is the result of the expression: 5 + '5'?
10
55
TypeError
5
Which keyword is used to define a function in ?
func
define
function
method
What will the following code output: console.log(5 == '5')?
true
false
TypeError
Undefined
