0

Getting stuck on Javascript Module 3 Pro Practice: Admission In Pairs

Admission In Pairs https://www.sololearn.com/learning/1024/1137/1398/1 Executing the same output. function main() { var numberGuests = parseInt(readLine(2),) var numberGuests = 2; if (numberGuests == 2){ console.log("Right"); } else if (numberGuests != 2) { console.log("Wrong"); } else { console.log("o"); } }

14th Jan 2021, 10:53 PM
Cyndria Abernathy
Cyndria Abernathy - avatar
2 Respostas
+ 1
/* Try this code using Conditional (ternary) operator */ function main() { var numberGuests = parseInt(readLine(), 10) // Your code here numberGuests % 2 === 0 ? console.log("Right") : console.log("Wrong") }
11th Apr 2021, 5:14 AM
Osama
Osama - avatar
0
Try using % in your statement. This will give you a remainder which you can then compare to other numbers. If (36 % 2 == 0) { console.log("Right"); } else { console.log("Wrong")
18th Jan 2021, 12:12 PM
Xavier
Xavier - avatar