Browsers such as Chrome and Firefox offer an API console that allows you to highlight formatted log messages, for example:
>>> console.log("%s has %d points", "Sam", "100"); Sam has 100 points
Now suppose I want to generate a formatted string, but it is not necessary to write it to the console. Does the browser provide a built-in function that creates log lines? Is it an ECMA-stardard? Or should we be content with third-party libraries like JavaScript sprintf ?
source share