Web technologies Questions | JavaScript Course Quiz 2 | Question 4

What will be the output of the following code?

filter_none

edit
close

play_arrow

link
brightness_4
code

<script>
  document.write((0 && 1) || (1 || 0));
</script>

chevron_right


(A) 0
(B) false
(C) true
(D) 1


Answer: (D)

Explanation: The && (and operator) returns the last (right-side) value as long as the chain is “truthy”. The || (or operator) returns true if either of the value is true.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

About immukul

Executive Software Developer at Cavisson Systems