• Post author:
  • Post category:Blog
  • Reading time:2 mins read
  • Post last modified:June 12, 2024

The result of the operation 20 || 5 will be:

  • 5
  • 25
  • 20
  • true
Answers Explanation & Hints:

In JavaScript, the double vertical bar “||” is indeed used as the logical OR operator. The logical OR operator in JavaScript returns the first operand if it is truthy, otherwise, it returns the second operand.

In the case of the expression “20 || 5”, both 20 and 5 are considered truthy values in JavaScript. Therefore, the result of the operation would be 20, which is the first truthy value encountered.

To illustrate this in code:

console.log(20 || 5); // Output: 20

So, the result of the operation “20 || 5” in JavaScript is 20.

For more Questions and Answers:

JavaScipt Essentials 1 (JSE) | JSE1 – Module 3 Test Exam Answers Full 100% 

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments