30 Days Of JavaScript

Day 3: Logic

Wrap up

Congratulations on finishing another day 😀

Conditional logic and this kind of flow control is a big part of programming and, while it might seem confusing right now, in time it will become second nature.

This is the first time we have taken an earlier concept, booleans (true/false), and combined it with something new so if you're brain is spinning that's to be expected.

Exercise

To wrap up today I have a small task for you to complete. In the playground below we have 2 weather inputs, temperature and conditions.

temperature can be any number and conditions can be any of: raining, sunny and foggy.

Based on the conditions and temperature we need a script that will console.log() a message for what to wear. Let's keep it to 6 outputs so it's not too much code, the clothing advice will be:

ConditionsBelow 15°CAbove 15°C
RainingThick CoatThin Coat
SunnyLight JumperT-Shirt
FoggyBright CoatWhere Are You?

Once you've got that working, then add an override variable called bothered, if bothered === true then run through the above code and console.log() the result. If the user is not bothered (=== false) then skip the whole section and console.log() "Best of luck!"

(Remember you can make the coding playground area wider by hovering on and dragging the vertical divider)

🚀 Share on Twitter
Time for a quiz

It good to test your knowledge just after learning something new, it solidifies the connections in your mind and identifies any areas that you should go back over.

The Pro version of 30 Days of JavaScript comes with a 10 question multiple choice quiz at the end of each day, if you want to take these quizzes (and get a host of other Pro features) then consider:

Joining Pro today

Outline

Go Pro?

Upgrade to Pro for quizzes, tracked progress and a completion certificate for just $25 🚀

Want more developer tips, tricks and tools?
Then follow me:
FREE Coding Career Quick Start Guide 🚀
Discover the best way to learn to code, how to land a job and valuable resources to help your journey in this free 15 page value packed guide.
Looking to email me? You can get me on my first name at allthecode.co