Javascript Boolean Operator Question 3

Introduction

What is the output of the following code:

console.log( //from w  w w  .  j ava 2s .  co  m
   "false && false: " + ( false && false ) +
   "\nfalse && true: " + ( false && true ) +
   "\ntrue && false: " + ( true && false ) +
   "\ntrue && true: " + ( true && true ) );
console.log( 
   "<td>false || false: " + ( false || false ) +
   "\nfalse || true: " + ( false || true ) +
   "\ntrue || false: " + ( true || false ) +
   "\ntrue || true: " + ( true || true ) );
console.log( ( !false ) +  "\n" + ( !true ) );


false && false: false
false && true: false
true && false: false
true && true: true
false || false: false
false || true: true
true || false: true
true || true: true
true
false
console.log( /*from w  ww.  j av  a2  s  . c  o  m*/
   "false && false: " + ( false && false ) +
   "\nfalse && true: " + ( false && true ) +
   "\ntrue && false: " + ( true && false ) +
   "\ntrue && true: " + ( true && true ) );
console.log( 
   "<td>false || false: " + ( false || false ) +
   "\nfalse || true: " + ( false || true ) +
   "\ntrue || false: " + ( true || false ) +
   "\ntrue || true: " + ( true || true ) );
console.log( ( !false ) +  "\n" + ( !true ) );



PreviousNext

Related