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!
25 Réponses
+ 4
if(month == "August"){
console.log("vacation")
}
+ 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✌
+ 1
Im still getting an error! The error refernece starts with ‘August is not defined at main’
+ 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!
+ 1
var month = readLine()
//your code goes here
if (month == "August")
{console.log("vacation");}
Good Luck
0
The parseInt() function parses a string argument and returns an integer of the specified
0
Matthew
Just write
var month = readLine();
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.
0
This discussion really helped me for getting an output thanks guys for discussin here the problem
0
var month = parseInt(readLine(), 10)
//your code goes here
if (month = "August")
{
console.log("vacation")
}
0
var month = readLine()
//your code goes here
if (month=="August")
{
console.log("vacation");
}
0
if(month == "august"){
console.log("vacation");
}
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
0
Try this one:
var month = readLine();
if(month == "August") {
console.log("vacation")
}
- 1
"==" (equality operator) instead of "=" (assignment operator)
- 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);}
- 1
That would make sense. However it still outputs ‘no output’.
- 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?
- 1
how to code on android