s = 'hello %s, how are you doing' % (my_name)
That’s how you do it in python. How can you do that in javascript/node.js?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note, from 2015 onwards, just use backticks for templating
Note that it is a backtick, not a quote.
If you want to have something similar, you could create a function:
Usage:
This is only a simple example and does not take into account different kinds of data types (like
%i, etc) or escaping of%s. But I hope it gives you some idea. I’m pretty sure there are also libraries out there which provide a function like this.