J
J
jazzus2019-09-25 17:22:53
Vue.js
jazzus, 2019-09-25 17:22:53

How to quote a variable inside a string?

You need to take the contents of the name variable in quotes here

<TermsConfirm
  :by="'clicking '+name"
>
</TermsConfirm>

to end up with the string
clicking 'Confirm'
How to do this if the content of the name variable is the word Confirm without quotes?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2019-09-25
@jazzus

<TermsConfirm
  :by="`clicking '${name}'`"
>

E
Eugene Chefranov, 2019-09-25
@Chefranov

by="'clicking '+'''+name+'''"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question