+ 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.
9 Respostas
+ 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
+ 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");
}
}
+ 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.
+ 4
Thank you guys for your help and thank you for your time.
My hand ahead salute 👍
+ 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,
+ 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 "===".
+ 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.
+ 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,..