Significance of the Underscore Parameter in Arrow Functions


Reading code I noticed some devs have been using an underscore, _ => {...}, in their arrow function rather than empty parentheses, () => {...}. At first I thought this was further syntactic sugar of the ES2015+ specifications that I had missed, some convenience keyword.

But I just realized that people have just been using (abusing?) the single parameter with no parenthesis syntax. Basically passing a variable called _ to the function and never using it as a means of not having to type two characters thus “saving” time.

To be clear, these are all the same:

a => {...}
foo => {...}
ಠ_ಠ => {...}
_ => {...}

I’m not sure how I feel about it, the jury is out. On one hand it does save typing a character, on the other it feels… wrong.