4 lines
200 B
JavaScript
4 lines
200 B
JavaScript
/* https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format */
|
|
String.prototype.format = function(array) {
|
|
return array.reduce((p,c) => p.replace('{}',c), this);
|
|
}; |