Open In App

Web technologies Questions | JavaScript Course Quiz 2 | Question 4

What will be the output of the following code?




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

(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

Article Tags :