Vacation Month Javascript exercise | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Vacation Month Javascript exercise

I cannot specify the otherwise statement. Some ideas?

9th Sep 2021, 8:23 PM
Longhua68
Longhua68  - avatar
8 Answers
+ 5
Can you please link your code? Do you mean the else statement?
9th Sep 2021, 8:37 PM
Lisa
Lisa - avatar
+ 2
Longhua68 No need of else part just change the line of input to this: var month = readLine(); As "August" is a String so need to parse with parseInt. Mostly users didn't use their brain here. 😃😃
10th Sep 2021, 8:43 AM
A͢J
A͢J - avatar
+ 1
Exactly! Because in this lesson the else statement was not introduced yet I thought there was another way even if logic says an if always pair with an else. But even by using the else statement how can I leave it without an output as specified in the instructions? In any case, the code I am using is not taken by the system. Pls. see my code hereafter: var month = parseInt(readLine(), 10) //your code goes here if (month == "August"){ console.log ("vacation"); } else {console.log("")}
10th Sep 2021, 7:50 AM
Longhua68
Longhua68  - avatar
+ 1
Thank you AJ.
10th Sep 2021, 6:30 PM
Longhua68
Longhua68  - avatar
0
If you don't want any output for "else" why don't you leave the else-part out?
10th Sep 2021, 7:56 AM
Lisa
Lisa - avatar
0
Sorry, i have no clue
10th Sep 2021, 4:40 PM
Longhua68
Longhua68  - avatar
0
Are. We supposed to have studied this in the course?
10th Sep 2021, 4:42 PM
Longhua68
Longhua68  - avatar