0

In JavaScript OD, the code like this:

[0, 1, 2, 3, 4].reduce( (prev, curr) => prev + curr );
var maxCallback = ( pre, cur ) => Math.max( pre.x, cur.x );

I have searched in Google with "=> in Javascript", but patched nothing, what does it mean?

zedong
  • 393
  • 2
  • 5
  • 15
  • 2
    It refers to an arrow function (https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/Arrow_functions). If this is brand new to you, you should google ES6 JS features. – mcranston18 Sep 13 '16 at 01:12
  • 2
    http://stackoverflow.com/questions/32866037/what-does-mean-in-javascript-equals-greater-than – Nodir Rashidov Sep 13 '16 at 01:12

0 Answers0