Skip to content

Instantly share code, notes, and snippets.

@kevmor11
Created April 4, 2017 03:03
Show Gist options
  • Save kevmor11/c55466926b8639901c2dfac5852d6ffe to your computer and use it in GitHub Desktop.
Save kevmor11/c55466926b8639901c2dfac5852d6ffe to your computer and use it in GitHub Desktop.
Password Obfuscator Function
function changeWord (string) {
var result = "";
for (var i = 0; i < string.length; i++) {
if (string[i] === "a") {
result += "4";
} else if (string[i] === "e") {
result += "3";
} else if (string[i] === "o") {
result += "0";
} else if (string[i] === "l") {
result += "1";
}
else
result += string[i];
}
return result;
};
console.log(changeWord("password"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment