V
V
Vitaly2016-07-22 13:10:08
JavaScript
Vitaly, 2016-07-22 13:10:08

How to 'convert' a string to a string with back quotes?

All the best!
A little strange question :)
Let's say we have a variable
let a = 'my name is string'
, is it possible to convert it later into the back quotes format for its further use with all the sugar
`my name is ${name}`
?
To be precise, I have a file that I read with a node, and in which I need to make replacements. It would be cool to insert ${name} into the text of the file instead of replace . I hope I can explain what I mean :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rinatoptimus, 2016-07-22
@rinatoptimus

And if you immediately write in such quotes?

V
Vitaly, 2016-07-22
@vshvydky

As I understand it, in a you will receive the file as a string, then create let b =`${a}`, or something like that, it will have to eat, after that all ${}, in theory, should start to be processed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question