Сколько гулять?


#1

var temperature = 20;
var itsRaining = false;
var minutes;
var optimal = 20;
var n = optimal - temperature;

if (temperature > 35 || temperature < 0 || itsRaining) {
minutes = 0;
console.log(‘Прогулка не состоится’);
}
else {
if (temperature <= optimal) {
minutes = optimal - n;
}
else if(temperature >= optimal){
minutes = optimal + n;
}
}