14.2 Java script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

14.2 Java script

I’m struggling to work this one out! You are planning a vacation in August. You are given a program that takes the month as input. Task Complete the code to output "vacation", if the given month is August. Don't output anything otherwise. Sample Input August Sample Output vacation My current code looks like this: var month = parseInt(readLine(), 10) //your code goes here if (month = August){console.log(vacation)} Any help is much appreciated!

9th Sep 2021, 9:15 PM
Matthew
25 Answers
+ 4
if(month == "August"){ console.log("vacation") }
22nd Oct 2021, 4:47 PM
Тарас Михайлина
Тарас Михайлина - avatar
+ 4
/* Solution From Here Just copy & paste😎: Note: "=" (assignment operator), So we use: "==" (equality operator) And we try this: */ //your code goes here if (month == "August"){ console.log("vacation") } //Keep coding✌
24th Jan 2023, 6:16 AM
ASHUTOSH
ASHUTOSH - avatar
+ 1
Im still getting an error! The error refernece starts with ‘August is not defined at main’
9th Sep 2021, 9:24 PM
Matthew
+ 1
Oh thats so dang annoying. How the heck am i supposed to learn this stuff if the given information is bugged?! I pay for this!
11th Sep 2021, 1:05 AM
Paul Cadena
+ 1
var month = readLine() //your code goes here if (month == "August") {console.log("vacation");} Good Luck
25th Jan 2022, 7:43 AM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
0
The parseInt() function parses a string argument and returns an integer of the specified
9th Sep 2021, 9:52 PM
SoloProg
SoloProg - avatar
0
Matthew Just write var month = readLine();
10th Sep 2021, 5:35 AM
A͢J
A͢J - avatar
0
That has fixed the issue thank you! It’s just very frustrating because Sololearn tell you that they have already sorted the Input out for you. So you assume that part of the code is correct. Especially because the course has not gone through inputs yet.
10th Sep 2021, 5:53 AM
Matthew
0
This discussion really helped me for getting an output thanks guys for discussin here the problem
11th Sep 2021, 4:46 AM
Fantastic Faisal Khan
Fantastic Faisal Khan - avatar
0
var month = parseInt(readLine(), 10) //your code goes here if (month = "August") { console.log("vacation") }
14th Nov 2021, 10:15 AM
Maleesha Kumarasinghe
Maleesha Kumarasinghe - avatar
0
var month = readLine() //your code goes here if (month=="August") { console.log("vacation"); }
9th Apr 2022, 12:51 AM
Gustavo Omar
0
if(month == "august"){ console.log("vacation"); }
8th Dec 2022, 10:15 AM
andreas lampah
andreas lampah - avatar
0
Here is what I dont understand. var month = parseInt(readLine(), 10) //your code goes here if (month = "August") { console.log("vacation") } this is for the input of August and the output of Vacation which must stay in the code. but then you have to add unput of September with no output and I am unclear as to how to add that to the existing code
24th Feb 2023, 2:20 PM
Kimmie J. Warden
Kimmie J. Warden - avatar
0
Try this one: var month = readLine(); if(month == "August") { console.log("vacation") }
27th Feb 2023, 8:38 AM
Uladzislau Murashka
Uladzislau Murashka - avatar
- 1
"==" (equality operator) instead of "=" (assignment operator)
9th Sep 2021, 9:19 PM
Abhay
Abhay - avatar
- 1
Okay this did make my code not make an error. However it only outputs ‘no output’ even when testing with sample input August My code now looks like this: if (month == "August") {console.log(vacation);}
9th Sep 2021, 9:39 PM
Matthew
- 1
That would make sense. However it still outputs ‘no output’.
9th Sep 2021, 9:46 PM
Matthew
- 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ So is it a solo learn bug? What do i need to change with the input?
10th Sep 2021, 5:04 AM
Matthew
- 1
how to code on android
11th Sep 2021, 6:52 AM
Lâm Vũ Đào