I know it's possible to 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 extend this to two or more arguments?
ie x=y,z=>y+z
or similar to correspond to function x(y,z){ return y*z; }
function x(y,z){ return y*z; }
Is there a similar convention to the very first example that allows for two or more arguments? I know that the x=y,z=>y+z
syntax isn't right as I get errors regarding the definitions of at least one of variables... So how can it be done, or rather... can it be done??
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.