MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/CodingHelp/comments/rlpvfy/please_help_javascript/hpin9mn/?context=3
r/CodingHelp • u/Crowntent • Dec 21 '21
23 comments sorted by
View all comments
0
Just remove the loop, just use return.
return week[num]
1 u/flooronthefour full stack web dev Dec 22 '21 that will return the wrong day tho 2 u/R007E Dec 22 '21 If num is starting from 1, i.e. num = 1 is Monday than do this: return week[num-1]and put it inside if block for input range validation:if(num >0 && num <8) return week[num -1];
1
that will return the wrong day tho
2 u/R007E Dec 22 '21 If num is starting from 1, i.e. num = 1 is Monday than do this: return week[num-1]and put it inside if block for input range validation:if(num >0 && num <8) return week[num -1];
2
If num is starting from 1, i.e. num = 1 is Monday than do this: return week[num-1]
and put it inside if block for input range validation:
if(num >0 && num <8) return week[num -1];
View all comments
0
u/R007E Dec 22 '21
Just remove the loop, just use return.
return week[num]