Javascript Abbreviations

I know that you can define a function this way:

x=y=>y*y

which corresponds to:

function x(y){ return y*y; }

But I was wondering, is it possible to expand to two or more arguments?

i.e. x=y,z=>y+zor similar, appropriatefunction x(y,z){ return y*z; }

Is there a similar convention for the very first example that allows two or more arguments? I know that the syntax is x=y,z=>y+zincorrect, because I get errors regarding the definitions of at least one of the variables ... So how can this be done, or rather ... can this be done?

+3
source share
1 answer

yes try

x=(z,y)=>z*y 

haha: D http://jsfiddle.net/FaSv2/

+2
source

All Articles