diff --git a/Javascript/2-logical-operators.js b/Javascript/2-logical-operators.js index c0d8588..0075455 100644 --- a/Javascript/2-logical-operators.js +++ b/Javascript/2-logical-operators.js @@ -16,6 +16,12 @@ console.log('Mix of Tea AND Juice is ' + goodDrinks); console.log('Mix of Vodka AND Beer is ' + badDrinks); console.log('Mix of Vodka AND Juice is ' + badMix); +const logicalAndFirstFalse = 'string' && 0 && 10; // 0 +console.log('\'string\' && 0 && 10 => ' + logicalAndFirstFalse); + +const logicalAndLastTrue = 'string' && 5 && 10; // 10 +console.log('\'string\' && 5 && 10 => ' + logicalAndLastTrue); + const engine1 = true; const engine2 = false; @@ -27,6 +33,12 @@ console.log('The first engine works? - ' + engine1); console.log('The second engine works? - ' + engine2); console.log('Is the plane still flying? - ' + fly); +const logicalOrFirstTrue = 'string' || 0 || 10; // 'string' +console.log('\'string\' || 0 || 10 => ' + logicalOrFirstTrue); + +const logicalOrLastFalse = '' || null || 0; // 0 +console.log('\'\' || null || 0 => ' + logicalOrLastFalse); + const happy = true; const mood = !happy; // false