Comparison Operators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Comparison Operators

I’m trying to solve the code challenge Change Your Password in javascript. I can’t figure out what is wrong with my code. var oldPass = readLine() var newPass = readLine() console.log(oldPass == newPass); Based on the lesson (comparison operator equality) this seems correct. Why is it not?

16th Sep 2020, 10:45 PM
Stefanie
Stefanie - avatar
4 Answers
+ 1
I tried : console.log(oldPass == newPass ) it worked. what error did you get?
16th Sep 2020, 11:01 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
i get false for all 5 tests but 3 of them should be true
16th Sep 2020, 11:09 PM
Stefanie
Stefanie - avatar
0
could you share the whole code, create a private code and send me the link.
16th Sep 2020, 11:14 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
the issue is in ++ function readLine() { return inputString[currentLine ]; } change it to function readLine() { return inputString[currentLine++]; }
16th Sep 2020, 11:52 PM
Bahhaⵣ
Bahhaⵣ - avatar