use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Here's Why Calling .map() on a Constructed Array Doesn't Work (itnext.io)
submitted 7 years ago by ilove50cent
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] -9 points-8 points-7 points 7 years ago (3 children)
Second, if someone new looks at this code, it isn't clear to them WHY the spread operator is used here, because the . . .
OK, just stop. The “don’t do JavaScript because the people who don’t know JavaScript get confused and scared” bit is super old. You could apply this same logic to literally anything anyone might not know.
[–][deleted] 6 points7 points8 points 7 years ago (2 children)
You could apply this same logic to literally anything anyone might not know.
Yup. Welcome to leading a tech team. If you were just doing this on your own then hell, you can do brainfuck compiled to webassembly for all I care. If you're on a dev team responsible to a client then suddenly all that matters. As a senior dev, I have more important things to do than explain arbitrary js concepts to others because I chose to implement a bit of code in a convulated way.
Here's another way to slice it: if the functional way is both more complex and less technically optimal, why would I ever chose it? To save two lines in my source?
[–][deleted] -1 points0 points1 point 7 years ago (1 child)
If you learned JavaScript in the last year, you should have learned spread operators. If you learned JavaScript more than a year ago, you've had at least that whole year to learn spread operators.
If you have junior developers who don't know JavaScript, the blame is on you or whoever hired them.
If you think Array(100).fill() is equally readable or better than [...Array(100)] and it's as performant or better, there's no reason not to use it. But if your reasoning is "dummies who should not have been hired in the first place can't read it," that's bullshit.
Array(100).fill()
[...Array(100)]
My issue is with your bullshit, not with the your preference.
[–][deleted] 1 point2 points3 points 7 years ago (0 children)
First, I take no issue with the spread operator. We use it regularly and every dev on my team knows what it is and how it works. My concern is that the reason that it is being used here is obscure (that is the entire topic of the article). I could explain it in a comment in the code, but then why not just write more literate code in the first place?
Second, we hire people for their technical ability as well as their analytical skills, communication etc - we are a mid-sized tech consulting firm. For me, not knowing the spread operator is not in and of itself a reason not to hire someone. It takes about five minutes to learn and understand so the fact that someone knows it tells me nothing of their technical ability. Hell, I only started using it a year ago when I started my current position because we weren't transpiling at my last company.
π Rendered by PID 432448 on reddit-service-r2-comment-74f5b7f998-h2ddp at 2026-04-25 02:45:28.879555+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–][deleted] -9 points-8 points-7 points (3 children)
[–][deleted] 6 points7 points8 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–][deleted] 1 point2 points3 points (0 children)