/ Published in: JavaScript
Expand |
Embed | Plain Text
function printArray(format, arry) { var i = 0; return format.replace(/%s/g, function($0) { return arry[i++]; }); } var a = ["foo", "bar", 1] printArray("%s+%s, %s 2 3", a); // foo+bar, 1 2 3
You need to login to post a comment.
