Skip to content

Instantly share code, notes, and snippets.

@lusan
Created June 29, 2016 09:45
Show Gist options
  • Save lusan/082dd0c14427ec7219e860969f470293 to your computer and use it in GitHub Desktop.
Save lusan/082dd0c14427ec7219e860969f470293 to your computer and use it in GitHub Desktop.
var inputString = "dilip %s Kumar %s";
var finalString;
function manipulateString(param) {
finalString = inputString;
for(var i = 0; i <= arguments.length; i++) {
finalString = finalString.replace('%s',arguments[i]);
}
return finalString;
}
console.log(manipulateString("is", "cool"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment