Why does encrypting do no good?
var base64encrypted = "U2tpbGxlZEhhY2tlcg==";
var enteredPassword = document.querySelector("#password").value;
if (encryptPassword(enteredPassword) === base64encrypted) {
// give keys to the kingdom - you are the chosen one
}
Because this:
var encryptPassword = function (password) {
return "U2tpbGxlZEhhY2tlcg=="; // encrypt override
}
That is a very simple example. Do not use passwords in JavaScript.
Extra for experts - try to figure out the password that was used.