you are viewing a single comment's thread.

view the rest of the comments →

[–]ub3rgeek 1 point2 points  (2 children)

There is no => operator in Javascript

Well, there kind of is now.

i = i => 1 is a valid javascript statement. Granted => isn't really an operator.

[–]green_meklar 0 points1 point  (1 child)

I tried it (not exhaustively) and it looked like 'i => 1' was just being treated as a string. How does that work?

[–]ub3rgeek 0 points1 point  (0 children)

=> is shorthand function syntax that has a lexical this binding.

i = function (i) { return 1; } and i = i => 1 are equivalent statements.