Is there a polyfill for es6 arrow function?

Viewed 26591

Is there a polyfill for es6 arrow function?

the following code throws syntax error exception in IE, is there a polyfill to make IE support arrow functions?

var myFunc = ()=>{
    alert('es6');
}
myFunc();

Note: I don't want to use any transpiler.

Thanks in advance

4 Answers

A polyfill can add or fix missing built-in classes, functions, objects... but it cannot modify a compiler's accepted syntax.

There is no polyfill for arrow functions. It is a syntax error to write the code you have unless you use a transpiler.

Features that add new syntax can not be polyfilled.

I can only think of babel-standalone, which you can think of as a JIT compiler/transpiler (if that is OK with you).

Related