JavaScript Answers

How to use sprintf with Node.js?

Spread the love

To use sprintf with Node.js, we use the util.format method.

For instance, we write

const s = util.format("hello %s", "world");

to call util.format to return a formatted string with %s filled in with the arguments after the first.

Therefore, s is 'hello world'.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.