Quotes wrongly closing js

0

With a PHP file I'm inserting javascript code. So I'm using echo.

echo ' grammar: "\name = s:[0-9a-zA-Z]+ { return s.join(""); }\n\" ';

The problem is that it is giving error because within s.join("") is closing with the grammar quotes.

I can not change to single quotation marks within the join, otherwise I would close with echo. I believe you have to try to escape the quotes. Would anyone know how to do this?

    
asked by anonymous 06.07.2018 / 06:34

1 answer

0

The problem here is that in this place where giving error should be single quotes because the string passed in JS is open as double quotation marks.

06.07.2018 / 13:15