Node.jsでprintf風の文字列フォーマットをするには、util.format
関数を使うと良い。
const{format}=require('util')constmessage=format('値は %s のうちのどれかにしてください',[1,2,3])console.log(message)//=> 値は [ 1, 2, 3 ] のうちのどれかにしてください
公式ドキュメント: Util | Node.js v13.11.0 Documentation
Node.jsでprintf風の文字列フォーマットをするには、util.format
関数を使うと良い。
const{format}=require('util')constmessage=format('値は %s のうちのどれかにしてください',[1,2,3])console.log(message)//=> 値は [ 1, 2, 3 ] のうちのどれかにしてください
公式ドキュメント: Util | Node.js v13.11.0 Documentation