New course! Every coder should learn Generative AI!
Try a free lesson+ 1
can someone tell me whats wrong with my code?
function password(){ var p = prompt("please enter your password:"); if(p != 1234){ alert("incorrect password!"); } else if(p == "i want a new password"){ var v = prompt("please enter your old password"); if(v != p){ alert("incorrect password"); } else{alert("password set")} } else{ alert("correct password!"); } } password();
2 Answers
+ 1
not v != p
because in that case, p is a string "i want a new password"
and you want v not equal old password (1234)
0
thatmust have been the answer but ive tested it and couldnt make it work, so i am
stopping that experiment