-
• #2
Strange, works for me with 71.3.
Do you have minification turned on? Esprima (offline) doesn't like the ` character: "TypeError: Cannot read property 'length' of undefined". Online (closure compiler) minification works.
Try upgrading to the latest web ide :) -
• #3
Sun 2019.08.04
Strings are delimited with the double quote
"
Json name/value values and Html attributes delimited with the single quote
'
That character is the grave accent.
`
Template Literal
Proper usage as you require explained in detail by @allObjects
Single quotes go inside a double quoted string, (unless escaped as you show) not double embedded in a single quoted string.https://www.javascript.com/learn/strings
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals -
• #4
Do you have minification turned on? Esprima (offline) doesn't like the ` character
Hit. Without Esprima it works fine. Thanks!
-
• #5
Any chance of using a newer IDE version? If you installed the Chrome web app it should have updated to 0.71.3 weeks ago - I updated to a newer Esprima version some time ago which handles that fine.
I guess you're on the native download? I've just updated that to the latest version now - but if you can use it the chrome app is preferable since it auto-updates.
-
• #6
I'm fine with the bug, I don't need any minfication in this case (it won't modify the contents of that string anyway).
In 0.71.4 it says for
foo=`bar`;
using Esprima "TypeError: Cannot read property 'length' of undefined", or
using Closure [Advanced] :"No errors. Minifying 10 bytes to 11 bytes". -
• #7
TypeError: Cannot read property 'length' of undefined
I know, that's a bit odd, but it still seems to work?
-
• #8
Yes, it seems to work. But I tested only simple, single strings.
My code:
If I paste it on the left side of the IDE (Web IDE version 0.70.6) it works fine, if I try to upload it from the edit panel it gives the error message "Error: Line 1: Unexpected token ILLEGAL".
I'm using more complex strings also containing both single and double quotes, e.g.
A workaround would be
var foo = 'console.log("This is \\\"cool\\\".");';
andbar="Line1\nLine2"
, but that's hard to write. What's the cause of this error?