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") }

17th Feb 2021, 6:06 AM
NIKHIL SONAWANE
NIKHIL SONAWANE - avatar
12 Antworten
+ 2
Simba '===' is fine as soon as both operand are of same type (wich is the case here)...
17th Feb 2021, 6:28 AM
visph
visph - avatar
+ 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)
17th Feb 2021, 6:17 AM
visph
visph - avatar
+ 1
Ollie Q Semicolons are not mandatory in JavaScript with linebreaks. NIKHIL SONAWANE You’re missing another } at the end.
17th Feb 2021, 6:17 AM
Rick Astley
Rick Astley - avatar
+ 1
you still doesn't close your function curly braces, and you introduce syntax error in 'if' condition ^^
17th Feb 2021, 6:32 AM
visph
visph - avatar
+ 1
NIKHIL SONAWANE Go to your original code you put in the question. Add another curly brace } to the end. It should work.
17th Feb 2021, 6:33 AM
Rick Astley
Rick Astley - avatar
+ 1
function main() { var numberGuests = parseInt(readLine(), 10) // Your code here if ((numberGuests%2)==0) { console.log('Right') } else { console.log('Wrong') } } Good Luck
25th Jan 2022, 8:03 AM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
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 😭😭
17th Feb 2021, 6:30 AM
NIKHIL SONAWANE
NIKHIL SONAWANE - avatar
0
You are missing a curly brace } at the end of the code
18th Feb 2021, 8:48 AM
Destiny Felix
Destiny Felix - avatar
- 1
missing “;” on end of first line and on both alert()s
17th Feb 2021, 6:09 AM
Ollie Q
Ollie Q - avatar
- 1
Missing a curly brace }
18th Feb 2021, 9:55 AM
Lamya Alahyane
Lamya Alahyane - avatar
- 1
Change === to == because they aren't same
18th Feb 2021, 5:24 PM
Ahmed Mohammed Alnor Abdalmahmod Abdalslam
Ahmed Mohammed Alnor Abdalmahmod Abdalslam - avatar
- 2
View conversation on Facebook and friends that are
17th Feb 2021, 6:10 PM
Noura Moussa
Noura Moussa - avatar