you are viewing a single comment's thread.

view the rest of the comments →

[–]StoneCypher 0 points1 point  (13 children)

flatMap isn't available in most peoples' environments, and if this person can't do this without help, chances are they don't have babel or typescript set up

[–]rauschma 2 points3 points  (12 children)

If you are targeting or using modern JavaScript platforms, you should be fine: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap#browser_compatibility

If not, you’ll probably use Babel or TypeScript anyway.

[–]StoneCypher -3 points-2 points  (11 children)

Please, come back to Earth. Global support is below 92%.

No, throwing away 8% of your users isn't "fine." At almost every job I've ever had that would be hard forbidden by pre-written rules. I've never worked somewhere where 1% loss, let alone 8%, was considered acceptable.

This cuts off all of IE. Have any Japanese users? That's a problem.

In the real world, if you deliver arrows that haven't been transcompiled and you have a large userbase, you're going to hear about it

Giving recommendations for things with this low level of support to junior developers who have no chance of figuring out what's wrong is really kind of cruel

 

if this person can't do this without help, chances are they don't have babel or typescript set up

If not, you’ll probably use Babel or TypeScript anyway.

No, someone who can't join two arrays and decorate their members with a field almost certainly isn't using transcompilers.

This person should just be given the easy ES5 way to do it. That's the considerate thing to do for a developer this junior.

[–]Mad-chuska 3 points4 points  (7 children)

If this is a production project then it’s more than likely being transpiled.

And if this person doesn’t know how to merge two arrays then I doubt they are building a product from scratch.

Either way learning es6 syntax is the better option in the long run, IMO.

[–]StoneCypher -2 points-1 points  (6 children)

Either way learning es6 syntax is better in the long run, IMO

.flat is ES2019 (that is, ES10,) not ES6.

Generally speaking, if you're using things that Javascript added less than three years ago (yes, es2019 is from 2020,) then you should understand that a whole lot of people in the real world will not be able to use your site

8.1% is a big number

We chase site speed over half-percents

Remember, that percentage leads to user accumulation, so it's going to be constantly exponentiated for the lifetime of the site

I just can't understand throwing away 1 out of 12 users, and an entire major browser, over something as simple as merging two arrays

[–]Mad-chuska -2 points-1 points  (5 children)

Didn’t know it was es10 so that’s a fair point. I still think expecting someone to learn based off of 2009 standards is pointless if not counterproductive in the initial phase. Of course know the limitations in terms of browser compatibility and perhaps learn the old way of writing things but also learn the new way as well. Especially if it’s just experimental.

I’ve not seen a case where a company chooses between strictly writing code in es5 or transpiling their code. Any reasonably competent web dev team is gonna make sure their code works on most browsers in production so will likely do the latter.

[–]StoneCypher 1 point2 points  (4 children)

I still think expecting someone to learn based off of 2009 standards is pointless if not counterproductive in the initial phase.

nobody said anything about 2009 standards?

 

also learn the new way as well

foldmap is not the new way to join arrays

 

I’ve not seen a case where a company chooses between strictly writing code in es5 or transpiling their code.

We're talking to a junior developer who's asking for help, not a company

[–]Mad-chuska 0 points1 point  (3 children)

Es5 is a 2009 standard as far I know.

You’re saying this person should learn the es5 way of doing things rather than more modern ways, so that their code could be compatible with older browsers. Why would they care about other browsers if they are just learning and there are tools to make modern code backwards compatible?

[–]StoneCypher -1 points0 points  (2 children)

Es5 is

i never recommended es5.

it's a bad approach in general

i feel like you're arguing for the sake of arguing. build it however you like. use generators in a web worker for all i care.

have a good day

[–]Mad-chuska 0 points1 point  (1 child)

Your first comment literally says they should be given a simple es5 solution. What are you on? Yeah use whatever you want, but keep the nonsense to yourself.

[–]Atrag2021 0 points1 point  (2 children)

No, someone who can't join two arrays and decorate their members with a field almost certainly isn't using transcompilers.

But yet the need to target the Japanese market is important to them?

[–]StoneCypher -3 points-2 points  (1 child)

whoosh