Created
April 4, 2017 03:03
-
-
Save kevmor11/c55466926b8639901c2dfac5852d6ffe to your computer and use it in GitHub Desktop.
Password Obfuscator Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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