Boolean operators. Password comparison. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Boolean operators. Password comparison.

The new account password must not match the old one. Write a program that accepts the old and new passwords as input and outputs a boolean value (true or false) to the console, which indicates whether they match. Sample input data hl8792m hl8792m Example of output data true My attempt: function main() { var oldPass = readLine(); var newPass = readLine(); // ваш код oldPass = 'hl8792m'; newPass = 'hl8792m'; oldPass = 'nav19314lu'; newPass = 'Nav19314lu'; oldPass = 'Dave19981'; newPass = 'Dave19981'; console.log(newPass == oldPass); } the problem is that in all cases the result is "true". therefore, only 2 of the 3 tests are correct. Please help me solve this case.

13th Apr 2021, 12:42 PM
Олег Аминов
Олег Аминов - avatar
2 Answers
+ 3
Олег Аминов Why did you write Hard Code value when you are taking input? Почему вы записали значение Hard Code, когда вводите данные?
13th Apr 2021, 12:58 PM
A͢J
A͢J - avatar
0
My bad function main() { var oldPass = readLine(); var newPass = readLine(); // ваш код console.log(newPass == oldPass); } Thanks, friend
13th Apr 2021, 1:00 PM
Олег Аминов
Олег Аминов - avatar