Please don't top-post or quote signatures. Posting order restored.
I don't know if there is a way to do what you want with some technique
like the "language" attribute for recent versions of JavaScript. I've
never bothered trying.
But my curiosity remains.
First, I thought it was JavaScript 1.8 that just shipped with Firefox
3.
Second, assuming you have a browser with JavaScript 1.9, what are you
doing where you desperately need JavaScript 1.9 in production. If it
is just experimenting then you don't need to detect the language
version. If it really is production, JavaScript 1.9 will not be wide
spread for many years to come so I wouldn't see the point as most
browsers won't have support for it.
Use standard feature detection and add the desired functionality to
UAs that lack it:
if (typeof Array.prototype.reduce != 'function') {
// add your own reduce method
}
Set your feature detection for say version 1.5 or maybe 1.3 and you
don't care what ECMAScript implementation is being used.
I'm not quite sure how that avoids syntax errors. You could test for
features of the language that are in JavaScript 1.9. If those features
are present then only load script files that would other syntax error
in browsers missing JavaScript 1.9 support. Seems like an indirect
test for syntax. It might be more direct to use a try-catch block with
an eval inside where the evaluated code includes the desired syntax.
Then load the script files with JavaScript 1.9 syntax.
Peter