Skip to content

Instantly share code, notes, and snippets.

@mikaelvesavuori
Created February 10, 2018 17:48
Show Gist options
  • Save mikaelvesavuori/2334231ebf82fcadf049bf0afd9aab51 to your computer and use it in GitHub Desktop.
Save mikaelvesavuori/2334231ebf82fcadf049bf0afd9aab51 to your computer and use it in GitHub Desktop.
Check if ES6 is totally supported
var supportsES6 = function() {
try {
new Function("(a = 0) => a");
return true;
}
catch (err) {
return false;
}
}();
if (supportsES6) {
var script = document.createElement("script");
script.src = "my-es6-file.js";
document.head.appendChild(script);
}
@mikaelvesavuori
Copy link
Author

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