Last active
August 29, 2015 14:05
-
-
Save ratiw/9c7b3ef02eb2a1f6f3a8 to your computer and use it in GitHub Desktop.
javascript str_replace
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 str_replace(search, replace, subject) { | |
var result = subject; | |
for (var i = 0; i < search.length; i++) { | |
result = result.replace(search[i], replace[i]); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment