JavaScript Trivia #10
Welcome to JavaScript Trivia #10! Test your knowledge of JavaScript with these fun and challenging questions.
Question 1:
What is the correct way to declare a variable in JavaScript?
var x = 10;
int x = 10;
float x = 10;
const x = 10;
Question 2:
What is the result of 10 + “5” in JavaScript?
15
"105"
NaN
Error
Question 3:
Which of the following is not a valid JavaScript data type?
string
boolean
number
array
Question 4:
What operator is used for equality comparison in JavaScript?
=
==
===
!=
Question 5:
What does the console.log()
function do in JavaScript?
- Displays a message in an alert box
- Writes a message to the document
- Outputs a message to the console
- None of the above
Once you have answered all the questions, check your answers below:
Answers:
- 1.
var x = 10;
- 2.
"105"
- 3.
array
- 4.
===
- 5.
Outputs a message to the console
Can I get an explanation, please?