I don't understand how this => works. I googled "javascript =>" but found no good answer.
var isTriangle = (a,b,c) => Math.max(a,b,c)<(a+b+c)/2
I don't understand how this => works. I googled "javascript =>" but found no good answer.
var isTriangle = (a,b,c) => Math.max(a,b,c)<(a+b+c)/2
This is the new ECMAScript 6 fat arrow syntax for defining functions. Your example:
(a,b,c) => Math.max(a,b,c)<(a+b+c)/2
is approximately equal to:
function(a, b, c) { return Math.max(a,b,c)<(a+b+c)/2; }
...but a lot shorter.