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:44 PM
Views: 11
Tags: no tags
Two & = both must be true
|| = One or the other must be true
  1. let moonPhase = 'full';
  2. let isFoggyNight = false;
  3. if (moonPhase === 'full' || isFoggyNight === true){
  4.   console.log('Howl!')
  5. }
  6. else if (moonPhase === 'mostly full') {
  7.   console.log('Arms and legs are getting hairier.')
  8. }
  9. else if (moonPhase === 'mostly new'){
  10.   console.log('Back on two feet')
  11. }
  12. else {
  13.   console.log('Invalid moon phase')
  14. }