Search code examples
google-chromegoogle-chrome-devtoolsecmascript-harmony

How check if Google Chrome has #enable-javascript-harmony turned on


I'm trying to check if the user's from Google Chrome has activate the flag #enable-javascript-harmony.

I have no idea how to do it.

Any help will be appreciate.


Solution

  • Chrome flag enable-javascript-harmony turns on the V8 switch --harmony.

    You can check if it is enabled by testing some ES Next functions from http://node.green (with a flag in the first column), e.g.:

    const regexGreekSymbol = /\p{Script=Greek}/u;
    regexGreekSymbol.test('π');
    

    This returns true when ES Harmony is turned on and Uncaught SyntaxError: Invalid regular expression: /\p{Script=Greek}/: Invalid escape otherwise.