Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 25, 2021 10:06 pm GMT

Writing Arrow Functions with Parameters

  • Just like a regular function, you can pass arguments into an arrow function.
const double = (item) => item * 2;double(4);double(4) would return the value 8.
  • It is possible to pass more than one argument into an arrow function.
const myConcat = (arr1, arr2) => arr1.concat(arr2);
console.log(myConcat([1, 2, 3,], [4, 5])); will display [1, 2, 3, 4, 5]
  • Note:Java string concat() method concatenates multiple strings. This method appends the specified string at the end of the given string and returns the combined string. We can use concat() method to join more than one strings.

Original Link: https://dev.to/rthefounding/writing-arrow-functions-with-parameters-573b

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To