+ 3

Please can any one help? IT IS A JAVASCRIPT PROGRAMMING LANGUAGE

Reset account passwords should not be the same as the old password. Write a program that takes old and new passwords as inputs and outputs to the console the boolean value (true or false) that shows whether or not they match.

2nd Jun 2021, 9:48 PM
Mahlud Abdulrahman
Mahlud Abdulrahman - avatar
9 odpowiedzi
+ 2
Mahlud Abdulrahman Nura Programmer Bad practice. No need to write if and alse condition. Just do console.log(oldPass == newPass); //it will print true or false based on the comparison
3rd Jun 2021, 1:28 AM
A͢J
A͢J - avatar
+ 5
function main() { var oldPass = readLine("mahlud"); var newPass = readLine("abba"); // Your code goes here If("oldPass"=="newPass") { document.write("false"); } Else { document.write("true"); } }
2nd Jun 2021, 10:03 PM
Mahlud Abdulrahman
Mahlud Abdulrahman - avatar
+ 4
@🅰🅹 🅐🅝🅐🅝🅣 Hmm, To you may be bad, But I try to stay on the line; He is asking, and i gave him answer according to his code, because, he may not understand Your code clearly, so if he were ask to explain it, he may fail! But Did you know that when comparing its best to use "===" instead of "=="; Oh, believe me, to me that is what they strictly include in bad practicing. Thank you.
3rd Jun 2021, 1:43 AM
Nura Programmer
Nura Programmer - avatar
+ 4
Thank you guys for your help and thank you for your time. My hand ahead salute 👍
3rd Jun 2021, 6:53 AM
Mahlud Abdulrahman
Mahlud Abdulrahman - avatar
+ 2
function main() { var oldPass = readLine("mahlud"); var newPass = readLine("abba"); // Your code goes here If(oldPass === newPass) { document.write("false"); } Else { document.write("true"); } } Mahlud Abdulrahman Try this 👆, yours wont work because your are comparing string that contain "oldpassword" word and "newpassword" Which cannot be equal,
2nd Jun 2021, 11:39 PM
Nura Programmer
Nura Programmer - avatar
+ 2
Nura Programmer He may understand if he look the explanation properly (as given -> console.log(5 > 4)) and I know we have to use "===" instead of "==" because "===" compare same data types but as in the given excercise both inputs are string so I don't think to use "===".
3rd Jun 2021, 1:59 AM
A͢J
A͢J - avatar
+ 2
It requires to validate a password every time whenever a user engenders an account on any website or app. So, try to verify a valid password as well as put the substantiate password validation. Hope this helps. Note: ===== 1. Please use search bar before posting any question here. https://www.sololearn.com/Discuss/2695260/any-one-help 2. Always show your attempts first in solving that code problem.
3rd Jun 2021, 2:26 AM
‎ ຸ
+ 2
🅰🅹 🅐🅝🅐🅝🅣 Know you are working on a single data type, that is where you need to normally check for both value and its object type,..
3rd Jun 2021, 6:53 AM
Nura Programmer
Nura Programmer - avatar