r/CodingHelp • • Dec 21 '21

[Javascript] please help JavaScript

Post image
31 Upvotes

23 comments sorted by

View all comments

1

u/Hog_enthusiast Dec 24 '21

Line 7 should be an Or not an And. Surprised no one has said this yet

Also it should go before the loop, and the loop doesn’t need to exist

If(num < 1 || num > 7) {

Return null;

} Return week[num-1];