Boolean operators. Password comparison. | Sololearn: Learn to code for FREE!

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.

4/13/2021 12:42:56 PM

Олег Аминов

2 Answers

New Answer

+3

Олег Аминов Why did you write Hard Code value when you are taking input? Почему вы записали значение Hard Code, когда вводите данные?

0

My bad function main() { var oldPass = readLine(); var newPass = readLine(); // ваш код console.log(newPass == oldPass); } Thanks, friend