-
Notifications
You must be signed in to change notification settings - Fork 26.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Array.map() without using currentValue (no-unused-vars) #1970
Labels
Comments
I’d suggest never using What you want here is: const myCoolArray = Array.from({ length: 25 }, () => ({
x: getRandomInt(100),
y: getRandomInt(100),
}); |
To your original question, instead of |
TIL Array.from({length: X}) . . I don't believe that trick is widely known. |
Thanks @ljharb !! That's a very neat solution. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm in a situation where I'm trying to make an array of random x y coordinates but the underscore in the map function is being flagged as an unused var. I'm not sure if there is a better way to write this or if I should simply do an inline ignore in this case.
In short: how do I avoid the
no-unused-vars
error when I don't need thecurrentValue
required by theArray.map()
method?The text was updated successfully, but these errors were encountered: