Open mhaidarhanif opened 5 years ago
const adviseMe = weather => {
if (weather === 'Rainy') return 'bawa payung atau gunakan jas hujan'
else if (weather === 'Stormy') return '...'
else if (weather === 'Sunny') return 'pake t-shirt'
else if (weather === 'Cloudy') return 'santai aja'
else if (weather === 'Hot') return '...'
else if (weather === 'Cold') return '...'
else if (weather === 'Dry') return '...'
else if (weather === 'Wet') return '...'
else if (weather === 'Windy') return '...'
else if (weather === 'Hurricanes') return '...'
else if (weather === 'typhoons') return '...'
else if (weather === 'Sand - storms') return '...'
else if (weather === 'Snow - storms') return '...'
else if (weather === 'Tornados') return '...'
else if (weather === 'Humid') return '...'
else if (weather === 'Foggy') return '...'
else if (weather === 'Snow') return '...'
else if (weather === 'Thundersnow') return '...'
else if (weather === 'Hail') return '...'
else if (weather === 'Sleet') return '...'
else if (weather === 'drought') return '...'
else if (weather === 'wildfire') return '...'
else if (weather === 'blizzard') return '...'
else if (weather === 'avalanche') return '...'
else return 'cuaca yang enak untuk aktifitas'
}
const advise = adviseMe('Rainy')
console.log(advise)
const adviseMeSwitch = weather => {
switch (weather) {
case 'Rainy':
case 'Rain':
return 'bawa payung atau gunakan jas hujan'
break
case 'Stormy':
return 'kabarin keluarga yak'
break
case 'Sunny':
return 'santai aja cuy'
break
case 'Cloudy':
return 'ya mayan lah'
break
case 'Hot':
return 'bawa sunscreen'
break
case 'Cold':
return 'pake jaket yang tebel'
break
case 'Dry':
return 'pake pelembab'
break
case 'Wet':
return 'pake sepatu boots'
break
case 'Windy':
return '...'
break
case 'Hurricanes':
return '...'
break
case 'typhoons':
return '...'
break
case 'Sand-Storms':
return '...'
break
case 'Snow-Storms':
return '...'
break
case 'Tornados':
return '...'
break
case 'Humid':
return '...'
break
case 'Foggy':
return '...'
break
case 'Snow':
case 'Snowy':
return 'hore ada salju!'
break
case 'Thundersnow':
return '...'
break
case 'Hail':
return '...'
break
case 'Sleet':
return '...'
break
case 'Drought':
return '...'
break
case 'Wildfire':
return '...'
break
case 'Blizzard':
return '...'
break
case 'Avalanche':
return '...'
break
default:
return 'cuaca yang enak untuk aktifitas'
break
}
}
const weather1 = 'Rain'
const weather2 = 'Sunny'
const weather3 = 'Snow'
const advise1 = adviseMeSwitch(weather1)
const advise2 = adviseMeSwitch(weather2)
const advise3 = adviseMeSwitch(weather3)
console.log(weather1, '-', advise1)
console.log(weather2, '-', advise2)
console.log(weather3, '-', advise3)
const adviseMe = weather => {
switch (weather) {
case 'Rainy':
case 'Rain':
return 'bawa payung atau gunakan jas hujan'
break
case 'Stormy':
return 'kabarin keluarga yak'
break
case 'Sunny':
return 'santai aja cuy'
break
case 'Cloudy':
return 'ya mayan lah'
break
case 'Hot':
return 'bawa sunscreen'
break
case 'Cold':
return 'pake jaket yang tebel'
break
case 'Dry':
return 'pake pelembab'
break
case 'Wet':
return 'pake sepatu boots'
break
case 'Windy':
return '...'
break
case 'Hurricanes':
return '...'
break
case 'typhoons':
return '...'
break
case 'Sand-Storms':
return '...'
break
case 'Snow-Storms':
return '...'
break
case 'Tornados':
return '...'
break
case 'Humid':
return '...'
break
case 'Foggy':
return '...'
break
case 'Snow':
case 'Snowy':
return 'hore ada salju!'
break
case 'Thundersnow':
return '...'
break
case 'Hail':
return '...'
break
case 'Sleet':
return '...'
break
case 'Drought':
return '...'
break
case 'Wildfire':
return '...'
break
case 'Blizzard':
return '...'
break
case 'Avalanche':
return '...'
break
default:
return 'cuaca yang enak untuk aktifitas'
break
}
}
const weather = prompt('What is the weather today?')
const advise = adviseMe(weather)
console.log(weather, '-', advise)
Submit here.