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.
Hi, I am a passionate web developer with a strong background in Computer Science. I have done M.Tech in Computer Science from IIT Kanpur. And currently working as a Principal engineer in MNC.
Hi, I am a passionate web developer with a strong background in Computer Science. I have done M.Tech in Computer Science from IIT Kanpur. And currently working as a Principal engineer in MNC.
The day of week was just a example....
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.
Yes Sir, an array works well for months, days, etc.
The weekday example is not good...
Updating the code.
@frankwisniewski Above was just an example to illustrate how we can acheive the switch statement through JS object.
Thanks for one liner though!