Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Chris Beardsley
Added: Aug 27, 2018 2:52 PM
Views: 4
Tags: no tags
Question mark for truthy
  1. let isNightTime = true;
  2.  
  3. if (isNightTime) {
  4.   console.log('Turn on the lights!');
  5. } else {
  6.   console.log('Turn off the lights!');
  7. }
  8.  
  9. // Same as following
  10.  
  11. isNightTime ? console.log('Turn on the lights!') : console.log('Turn off the lights!');