0

J.S. how to avoid ' undefined ' on switch?

This code is supposed to display summer when it is summer, fall when it's fall, winter when It's... But right now It's summer, and It displays undefined for the other seasons. Is there a way to secure that '(avoid undefined)?

22nd Jun 2019, 4:14 AM
Ginfio
Ginfio - avatar
3 Respostas
22nd Jun 2019, 5:59 AM
Calviղ
Calviղ - avatar
+ 1
default:
22nd Jun 2019, 5:25 AM
Nico Ruder
Nico Ruder - avatar
+ 1
use default to set a value if all case values are not the input value
22nd Jun 2019, 5:37 AM
Nico Ruder
Nico Ruder - avatar