I have the latest Chrome version (45 and also Chrome Canary which is in version 47), both with the Experimental JavaScript flag enabled. I want to use ECMAScript 6, but it doesn’t work. I don’t know why. Is there any trick or other flag that must be enabled, too?
Every reserved word of ECMAScript 6 (like import
, class
, or whatever) throws an “Uncaught SyntaxError
: Unexpected reserved word” in Chrome 45 and an “Uncaught SyntaxError
: Unexpected token import
” error in Chrome Canary.
I asked this a few months ago without getting any answer but a “possible duplicate” of Using ECMAScript 6, but it does not solve my problem.
I want to use modules, since I like the ECMAScript modules more than using require
from CommonJS. And I also like the syntax sugar of classes — the code looks better.