bendc / frontend-guidelines

Some HTML, CSS and JS best practices.
8.29k stars 653 forks source link

ArrowFunctionExpression is not supported #742

Closed gouravtiwari closed 9 years ago

gouravtiwari commented 9 years ago

Hey @bendc This is AWESOME list! Thanks for putting it together. There is one issue though and may be I misunderstood this one:

const isEven = n => n % 2 == 0;

This throws error: SyntaxError: Unexpected token '>' also: ArrowFunctionExpression is not supported

This seems a coffee-script syntax, is it supported in JS?

vitortalaia commented 9 years ago

@gouravtiwari Unfortunately the compatibility for this spec is low... If you don't use Firefox, you can use Babel or Traceur for transpiling it to ES5

6temes commented 9 years ago

@gouravtiwari. The arrow function is Ecmascript 6, the new version of Javascript. It has not been released yet and most features are not implemented in any Browser, but you can "transpile" it to ES5 (the current Javascript) using Traceur.

igregson commented 9 years ago

Agreed. Using arrow functions in a "front-end guidelines" writeup is pretty misleading.

At least a simple note about it only being supported in ES6 would be helpful (for myself and likely others).

gouravtiwari commented 9 years ago

Thanks @vitortalaia and @6temes, I just created a PR https://github.com/bendc/frontend-guidelines/pull/747 for the same.

vitortalaia commented 9 years ago

:+1: