By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,459 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,459 IT Pros & Developers. It's quick & easy.

JavaScript 1.7 and Array Comprehensions

P: n/a
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David

Dec 4 '06 #1
Share this Question
Share on Google+
13 Replies


P: n/a
David Golightly wrote :
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David
You have to specify it in your code ...
<script type="application/javascript;version=1.7">
// code here
</script>

Default FF2 JS version is 1.6.

--
Naixn
http://fma-fr.net
Dec 4 '06 #2

P: n/a

naixn wrote:
David Golightly wrote :
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David

You have to specify it in your code ...
<script type="application/javascript;version=1.7">
// code here
</script>

Default FF2 JS version is 1.6.
Yeah, I saw that - I was hoping though to get it working in the JS
console in Firefox, so I can't use a script tag for that. The docs say
to use the "version" function, but that isn't working for some reason -
"version" is not defined.

Dec 4 '06 #3

P: n/a
David Golightly wrote :
naixn wrote:
>David Golightly wrote :
>>I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David
You have to specify it in your code ...
<script type="application/javascript;version=1.7">
// code here
</script>

Default FF2 JS version is 1.6.

Yeah, I saw that - I was hoping though to get it working in the JS
console in Firefox, so I can't use a script tag for that. The docs say
to use the "version" function, but that isn't working for some reason -
"version" is not defined.
Maybe you should use Firebug as the JavaScript console. Very useful (for
debugging), and all the more powerful ;)

--
Naixn
http://fma-fr.net
Dec 4 '06 #4

P: n/a

naixn wrote:
David Golightly wrote :
naixn wrote:
David Golightly wrote :
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David

You have to specify it in your code ...
<script type="application/javascript;version=1.7">
// code here
</script>

Default FF2 JS version is 1.6.
Yeah, I saw that - I was hoping though to get it working in the JS
console in Firefox, so I can't use a script tag for that. The docs say
to use the "version" function, but that isn't working for some reason -
"version" is not defined.

Maybe you should use Firebug as the JavaScript console. Very useful (for
debugging), and all the more powerful ;)

--
Naixn
http://fma-fr.net
I am, actually, using Firebug. I can't live without it. But it
doesn't add JS 1.7 support by itself :)

Dec 4 '06 #5

P: n/a
David Golightly wrote :
>
I am, actually, using Firebug. I can't live without it. But it
doesn't add JS 1.7 support by itself :)
Sure not. But if I go in the firebug console and type :
a = 'aString';
b = 'bString';
[a, b] = [b, a];
I get :
a ='bString'
b ='aString'

This is clearly JS 1.7.

--
Naixn
http://fma-fr.net
Dec 4 '06 #6

P: n/a

naixn wrote:
David Golightly wrote :

I am, actually, using Firebug. I can't live without it. But it
doesn't add JS 1.7 support by itself :)

Sure not. But if I go in the firebug console and type :
a = 'aString';
b = 'bString';
[a, b] = [b, a];
I get :
a ='bString'
b ='aString'

This is clearly JS 1.7.

--
Naixn
http://fma-fr.net
Try:

function range(begin, end) {
for (let i = begin; i < end; ++i) {
yield i;
}
}

what do you get then?

Dec 4 '06 #7

P: n/a
David Golightly wrote :
naixn wrote:
>David Golightly wrote :
>>I am, actually, using Firebug. I can't live without it. But it
doesn't add JS 1.7 support by itself :)
Sure not. But if I go in the firebug console and type :
a = 'aString';
b = 'bString';
[a, b] = [b, a];
I get :
a ='bString'
b ='aString'

This is clearly JS 1.7.

--
Naixn
http://fma-fr.net

Try:

function range(begin, end) {
for (let i = begin; i < end; ++i) {
yield i;
}
}

what do you get then?
In fact, I get
"missing ; after for-loop initializer"
which is the error I had with this function when not telling the browser I'm
using JS 1.7.
Strange... As [a, b] = [b, a]
is new from JS 1.7, as let/yield are...

Really strange.

--
Naixn
http://fma-fr.net
Dec 5 '06 #8

P: n/a
David Golightly wrote :
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David
I've been looking in the doc... The version() function is only for the JS
shell.
see: http://developer.mozilla.org/en/docs...vaScript_shell
And let/yield are, in fact, keywords that needs JS1.7 to be specified, contrary
to the array manipulation ([a, b] = [b, a]), which doesn't need it...

Loonking for a way to set it to JS 1.7

(why is that you absolutely want to do it console mode? :p)

--
Naixn
http://fma-fr.net
Dec 5 '06 #9

P: n/a

naixn wrote:
David Golightly wrote :
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David

I've been looking in the doc... The version() function is only for the JS
shell.
see: http://developer.mozilla.org/en/docs...vaScript_shell
And let/yield are, in fact, keywords that needs JS1.7 to be specified, contrary
to the array manipulation ([a, b] = [b, a]), which doesn't need it...

Loonking for a way to set it to JS 1.7

(why is that you absolutely want to do it console mode? :p)
No specific reason. Just wanted to test it out from the console
without downloading & building the shell, which I might just do anyway.
It just doesn't make a whole lot of sense for them to have new
features like this that simply aren't accessible from console mode, so
I was hoping someone else had already found a way around it.

Dec 5 '06 #10

P: n/a
David Golightly wrote :
naixn wrote:
>David Golightly wrote :
>>I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console. So many of the new features - especially using the
"let" and "yield" keywords, as well as practical Array comprehensions
which depend on these keywords - are not accessible. Has anyone had
any luck turning on JS 1.7 in the Firefox JS Console?

Thanks,

David
I've been looking in the doc... The version() function is only for the JS
shell.
see: http://developer.mozilla.org/en/docs...vaScript_shell
And let/yield are, in fact, keywords that needs JS1.7 to be specified, contrary
to the array manipulation ([a, b] = [b, a]), which doesn't need it...

Loonking for a way to set it to JS 1.7

(why is that you absolutely want to do it console mode? :p)

No specific reason. Just wanted to test it out from the console
without downloading & building the shell, which I might just do anyway.
It just doesn't make a whole lot of sense for them to have new
features like this that simply aren't accessible from console mode, so
I was hoping someone else had already found a way around it.
Well... Instead of using the shell, why wouldn't you build a blank HTML page?
May be simplier.

Oh, i just saw Firebug 1.0 beta was available ! Did you know?
http://getfirebug.com if not!

I was so waiting for it!!

--
Naixn
http://fma-fr.net
Dec 5 '06 #11

P: n/a
naixn wrote :
>
Well... Instead of using the shell, why wouldn't you build a blank HTML
page?
May be simplier.

Oh, i just saw Firebug 1.0 beta was available ! Did you know?
http://getfirebug.com if not!

I was so waiting for it!!
Oh, btw, Firebug 1 beta seems to get along with JS 1.7, though it seems not to
be perfect ... Maybe you should give a try.
I don't know if it's because I'm using Linux, but the design is absolutely not
the same as on the screens...

--
Naixn
http://fma-fr.net
Dec 5 '06 #12

P: n/a
naixn wrote :
>
Oh, btw, Firebug 1 beta seems to get along with JS 1.7, though it seems
not to
be perfect ... Maybe you should give a try.
I don't know if it's because I'm using Linux, but the design is
absolutely not
the same as on the screens...
I got my answer: the graphical render is a bug on debian based linux...
Had to install SwiftFox via Automatix to get it work :p

--
Naixn
http://fma-fr.net
Dec 5 '06 #13

P: n/a
David Golightly wrote:
I'm getting my feet wet with JavaScript 1.7 (Firefox 2.0 only) and
messing around with it in the console, working through some of the
exercises given at
http://developer.mozilla.org/en/docs...JavaScript_1.7

Looks like the "version" function isn't supported, at least not in the
Firefox console.
version is a function the Spidermonkey shell supports. That shell is a
command line shell you can use if you compile Spidermonkey yourself. It
is not in any way related to the browser like Mozilla or Firefox and has
nothing to do with the JavaScript console or Error console those
browsers have.
To use JavaScript 1.7 in a host document like HTML or SVG use
<script type="text/javascript; version=1.7">
for the script element.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 5 '06 #14

This discussion thread is closed

Replies have been disabled for this discussion.