0
Can anyone tell me what's wrong in this
Entrance to the club is only permitted in pairs. Take the number of customers in the club as input, and, if all of them have a pair, output to the console "Right", otherwise output "Wrong". Sample Input 14 Sample Output Right //mycode function main(){ var numberGuests = parselnt(redLine(), 10) if (numberGuests%2===0){ alert ("Right") } else{ alert("Wrong") }
12 Respostas
+ 2
Simba
'===' is fine as soon as both operand are of same type (wich is the case here)...
+ 1
NIKHIL SONAWANE
you need to properly close curly brace of your main function ^^
Ollie Q
';' is not compulsary in javascript (even if it's better practice to put them)
+ 1
Ollie Q Semicolons are not mandatory in JavaScript with linebreaks.
NIKHIL SONAWANE Youâre missing another } at the end.
+ 1
you still doesn't close your function curly braces, and you introduce syntax error in 'if' condition ^^
+ 1
NIKHIL SONAWANE Go to your original code you put in the question. Add another curly brace } to the end. It should work.
+ 1
function main() {
var numberGuests = parseInt(readLine(), 10)
// Your code here
if ((numberGuests%2)==0) {
console.log('Right')
} else
{
console.log('Wrong') } }
Good Luck
0
function main() {
var numberGuests = parseInt(readLine(), 10)
// Your code here
var numberGuests = 2;
if(numberGuests 14 % 2 == 0){
console.log("Right");
}
else if(numberGuests ! = 2){
console.log("Wrong");
}
Still not working đđ
0
You are missing a curly brace } at the end of the code
- 1
missing â;â on end of first line and on both alert()s
- 1
Missing a curly brace }
- 1
Change === to == because they aren't same
- 2
View conversation on Facebook and friends that are