Last active
August 29, 2015 14:12
-
-
Save kevin-miles/196a397787b9c90ae8a9 to your computer and use it in GitHub Desktop.
Dynamic Replacement of string parameters
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
//replaces a string's commas with spaces | |
var replacement = 'test'; | |
//in my use i had a for loop that used the index to generate the value | |
//in this example if you had it in a loop it would replace each '$NUMBER' with 'test' | |
for(var i=0; i<5; i++){ | |
final = final.split('$'+value).join(replacement); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment