Skip to content

Instantly share code, notes, and snippets.

@bendc
Created August 25, 2016 08:05
Show Gist options
  • Star 45 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bendc/d7f3dbc83d0f65ca0433caf90378cd95 to your computer and use it in GitHub Desktop.
Save bendc/d7f3dbc83d0f65ca0433caf90378cd95 to your computer and use it in GitHub Desktop.
Test if ES6 is ~fully supported
var supportsES6 = function() {
try {
new Function("(a = 0) => a");
return true;
}
catch (err) {
return false;
}
}();
@kenberkeley
Copy link

kenberkeley commented Mar 1, 2019

<html>
<head>
  <script>
  if (typeof Symbol === 'undefined') {
    document.write('<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=es6,es7&flags=gated"><\/script>')
  }
  </script>
</head>
<body>
</body>
</html>

@cai-zhuo
Copy link

cai-zhuo commented Mar 6, 2023

@triblondon Yup, the critical test is the a = 0 (all browsers supporting default parameters have a fairly complete support of ES6 -- for example, Edge 13 will be rejected by this test despite a decent ES6 coverage).

I wanna know how to prove “all browsers supporting default parameters have a fairly complete support of ES6”
Thankfully, if you can show links or refs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment