Reputation:
In python, I can do the following:
name = "bob"
print("Hey, %s!" % name)
Is there anything similar to that (or Python's .format()
) in JavaScript/NodeJS?
Upvotes: 12
Views: 17374
Reputation: 844
Another option is template strings
For example:
const name = "bob";
console.log(`Hey, ${name}!`);
Upvotes: 7