Show List
Quiz - JavaScript - 1
Select the right answer for below questions:
What is JavaScript used for?
Client-side scripting
Server-side scripting
Both A and B
None of the above
Both A and B
Which of the following is not a data type in JavaScript?
Number
String
Boolean
Function
Function
What is the correct syntax for creating a variable in JavaScript?
var x;
variable x;
let x;
const x;
var x;
How do you add a comment in JavaScript?
// This is a comment
/* This is a comment */
## This is a comment ##
// This is a comment
What is the output of the following JavaScript code?
console.log(2 + "2");
4
22
NaN
22
Which of the following is not an operator in JavaScript?
=
+
*
^
^
What is the purpose of the “break” statement in a JavaScript loop?
To terminate the loop
To skip the current iteration
To start a new iteration
None of the above
To terminate the loop
How do you declare a function in JavaScript?
function myFunction() {}
function = myFunction() {}
var myFunction = function() {}
myFunction() {}
function myFunction() {}
What is the output of the following JavaScript code? console.log(typeof null);
Null
Undefined
Object
Number
Object
What is the use of “else if” in JavaScript?
To replace the “if” statement
To specify a new condition to test
To execute multiple conditions
None of the above
To specify a new condition to test
Submit
Retry
{"qz1-703962":"Both A and B","qz1-703963":"Function","qz1-703964":"var x;","qz1-703965":"// This is a comment","qz1-703966":"22","qz1-703967":"^","qz1-703968":"To terminate the loop","qz1-703969":"function myFunction() {}","qz1-703970":"Object","qz1-703971":"To specify a new condition to test"}
Leave a Comment