This section covers the questions for JavaScript Operators to clear all your concepts.
Question 1
Given the following code:
console.log(foo());
var foo = function() {
return "Function Expression";
};
function foo() {
return "Function Declaration";
}
What will be logged to the console?
"Function Expression"
"Function Declaration"
TypeError
ReferenceError
Question 2
console.log(foo());
var foo = function()
{ return "Function Expression"; };
function foo()
{ return "Function Declaration"; }
What will be Logged to the console?
"Function Expression"
"Function Declaration"
Type Error
ReferenceError
Question 3
What will be the result of the following operation?
console.log(5 % 2);
1
2
1.5
5
Question 6
Which of the following operators is used to assign a value to a variable?
==
===
=
:=
Question 7
Find the output of the following.
for (var i = 0; i < 3; i++) {
setTimeout(function() {
console.log(i); }, 100);
}
ReferenceError
3 3 3
0 1 2
undefined undefined undefined
Question 8
What is the output of this ternary operation?
const value = 10;
console.log(value > 5 ? "Yes" : "No");
Yes
No
Error
Undefined
Question 10
What will the following code log?
console.log(5 == "5");
true
false
undefined
Error
There are 10 questions to complete.