Skip to content

Instantly share code, notes, and snippets.

@arctic-pie
Last active January 26, 2018 22:31
Show Gist options
  • Save arctic-pie/7484e156a5cd0f231f8e1d636772530e to your computer and use it in GitHub Desktop.
Save arctic-pie/7484e156a5cd0f231f8e1d636772530e to your computer and use it in GitHub Desktop.
var temperature = 15;
var itsRaining = false;
var minutes;
var MIN_TEMP = 0;
var MAX_TEMP = 35;
var PERFECT_TEMP = 20;
var conditionsAreNotSatisfied = temperature < MIN_TEMP || temperature > MAX_TEMP || itsRaining;
if (conditionsAreNotSatisfied) {
minutes = 0;
} else {
minutes = PERFECT_TEMP - Math.abs(PERFECT_TEMP - temperature)
}
console.log(minutes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment