Skip to content

Comment on ES6 in Depth: Destructuringparent

Comments

I tend to be a bit more meticulous than most when it comes to structure and organization of software projects (I'm downright anal), Though I do see your point... I've always just found it easier to work with the JS behavior, and simply verify critical data at critical points.

In terms of your example, in JS, I would expect c and d to be undefined. Though I sometimes wish that JS hadn't made the distinction between undefined as a value vs. null. However, the JS flow makes it easier to do something like...

    let [foo, bar, baz, optional] = getConditionsFor(id);
Where you expect certain values to only sometimes be there conditionally... To me this is flexibility that I appreciate, and once you are used to the JS way it becomes a lot more natural.

At this point I've written a lot of code in JS both on the server and the client... after 3 years of mostly node/js projects, I've spent the past week in .Net land and frankly I miss JS, though the JS on the web portion of this project is almost as painful. It's amazing how many times a small piece of coupled code can by copy/pasted instead of isolating it for reuse... Spending a week cleaning up such code to get a handle on a number of bugs, not fun.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.