JavaScript Operators

This section covers the questions for JavaScript Operators to clear all your concepts.

Last Updated :
Discuss
Comments

Question 1

What will be the result of the following operation?

JavaScript
console.log(5 % 2);


  • 1

  • 2

  • 0

  • 5

Question 2

Which operator is used to compare both value and type?

  • ==

  • ===

  • !=

  • =

Question 3

Which of the following is not a logical operator?
 

  • &&

  • ||

  • !

  • >

Question 4

Which of the following is a logical AND operator?


  • &&

  • ||

  • !

  • ^^

Question 5

Which of the following operators is used to assign a value to a variable?

  • ==

  • ===

  • =

  • :=

Question 6

What is the purpose of the nullish coalescing operator (??)?

  • To return true if both operands are null

  • To provide a default value when the left-hand side is null or undefined

  • To perform logical AND operations

  • To compare values strictly

Question 7

Ternary operator is the best alternative of which aspect of Javascript?
 

  • If-else

  • For loop

  • While loop

  • do-while loop

Question 8

What is the output of this ternary operation?

JavaScript
const value = 10; 
console.log(value > 5 ? "Yes" : "No");


  • Yes

  • No

  • Error

  • Undefined

Question 9

Which operator is used for optional chaining in JavaScript?

  • .?

  • ?.

  • ::

  • ->

Question 10

What will the following code log?

JavaScript
console.log(5 == "5");


  • true

  • false

  • undefined

  • Error

There are 10 questions to complete.

Take a part in the ongoing discussion