Created
August 25, 2016 08:05
-
-
Save bendc/d7f3dbc83d0f65ca0433caf90378cd95 to your computer and use it in GitHub Desktop.
Test if ES6 is ~fully supported
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var supportsES6 = function() { | |
| try { | |
| new Function("(a = 0) => a"); | |
| return true; | |
| } | |
| catch (err) { | |
| return false; | |
| } | |
| }(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MediaWiki previously used this snippet and is now updating it to also test for these ES2017 features:
See the update in patchset 1141401.
Ensuring ES2015 (ES6) grammar and syntax support:
Ensuring ES2017 (ES8) grammar and syntax support:
The crucial test is the one for trailing commas, as it was the last ES2017 feature to be implemented (for instance, in Chrome 58).
You can find more details in the "Feature summary" table at the end of this Feature support list on caniuse.com.