What you don’t know about web development
David Gilbertson

About the string.replace takes function and usages. Last time I’ve used it to generate error messages to user based on data returned somewhere else.

const string = `some dummy information about {} and {}`;
const values = [‘foo’, ‘bar’];
const replacer = (replaceArr) => () => replaceArr.shift();
string.replace(/\{\}/g, replacer(values) );
>> "some dummy information foo and bar"

It’s somehow useful example ;)