If statements | SoloLearn: Learn to code for FREE!


If statements

Whats the problem for this code of this task ? eEntrance 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 function main() { var numberGuests = parseInt(readLine(), 10) if (numberGuests%2 = 0) { document.write(Right); } else { document.write(Wrong); } }

11/27/2020 12:05:20 PM

Yasamin Kholafaei

1 Answer

New Answer


Yasamin Kholafaei , change first the if condition to numberGuests % 2 === 0, then "Right" and "Wrong" should be in quotes. For console output use console.log () method instead of document.write ().