0

JS help

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 function main() { var numberGuests = parseInt(readLine(), 10) // Your code here if (numberGuests == ) { console.log("Right"); } else { console.log("Wrong"); } } Think I'm missing something. They haven't taught how to determine if a number is even or odd.

12th Feb 2021, 7:19 PM
Daniel Searle
Daniel Searle - avatar
2 odpowiedzi
+ 1
% -> this operator returns the remainder. If numberGuests % 2 == 0, Right.
12th Feb 2021, 7:24 PM
Avinesh
Avinesh - avatar
0
Thanks! Makes sense now. Wouldn't have thought of using it that way
12th Feb 2021, 7:28 PM
Daniel Searle
Daniel Searle - avatar