DEV Community

Discussion on: Switch statements in javascript – How to refactor?

Collapse
 
vbarzana profile image
Victor A. Barzana

Yes sir, I agree with your comment, what I am trying to correct here is about replacing the switch, think of days of the week as fruits, and you will get my point.

Thread Thread
 
frankwisniewski profile image
Frank Wisniewski • Edited

Yes Sir, an array works well for months, days, etc.
The weekday example is not good...

Thread Thread
 
ajayv1 profile image
Ajay Kumar Verma

Updating the code.