I'm trying to use let
and yield
in Firefox. I am testing in both versions 18 and 21 (Nightly) and getting the same results.
Here's my really simple test script:
<html>
<head>
<title>test</title>
<script type="text/javascript">
'use strict';
function a() {
yield 5;
}
</script>
</head>
<body></body>
</html>
I get this error:
Similarly when I do a simple test with let
I get "let is a reserved identifier", which is really frustrating because let
has supposedly existed in Firefox since version 2!
Strangely, if I execute the same code in Firebug it works!
I have tried various other strings in the type
and language
attributes of the script
tag but have not found a magic one that works.
What's going on? How do I get this stuff working with a script tag?
Edit
Hmm, I see, so you must specify the version number. I had tried this, but for my original more complicated script which used web workers. Apparently using version=1.7
on a script which includes a web worker which includes a script that uses let
and yield
isn't good enough -- the web worker script still breaks... Then I tried reducing to simplest case but apparently didn't try version=1.7
in simplest case.
Thanks... Might post another question in a little bit (after searching) on how to get this working for web workers.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…