message format in javascript %s % j code example
Example 1: javascript string format
//
const firstName = 'john';
const lastName = 'smith';
const output = `name: ${firstName}, surname: ${lastName}`;
// name: john, surname: smith
Example 2: nodejs format text
var my_name = 'John';
var s = `hello ${my_name}, how are you doing`;
console.log(s); // prints hello John, how are you doing