Reputation: 15566
I haave the following line in my code :
invitationMessage = invitationMessage.replace(/{{from}}/g, from);
when i do jsLint on the code, it shows the following warning
unescaped {
what is the correct way to write this statement? What is wrong with this statement?
Upvotes: 2
Views: 100
Reputation: 6052
Escape the value {
and }
:
invitationMessage = invitationMessage.replace(/\{\{from\}\}/g, from);
Because these are RegExp
symbols which can be used like:
\*{1, 3}
It matches *
or **
or ***
. An asterisk with a length between 1
and 3
Upvotes: 4