Two things: template strings and arrow functions. Async is life-changing, but lack of support - can't use it yet.. Greatest feature since XMLHttpRequest IMO.
Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
41–50 of 62 posts
Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#42Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#43By "targeting ES6" do you mean writing ES6 and transpiling to ES5, or actually shipping ES6 to browsers?
Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#44My code runs on Node >6.9.1 so it's really a no-brainer. The synthax is clearly superior.
I just wrote this function and used `function` rather than `=>` because I couldn't get the syntax right using an arrow function:
const showTable = ["email", "phone", "website"].reduce(
function (previous, channel) { return previous || !!institution[channel] && !/^\s*$/.test(institution[channel]); },
false
);
Of course, the inconsistencies are what I don't like about js in general.Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#45Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#46My code runs on Node >6.9.1 so it's really a no-brainer. The synthax is clearly superior.
You know what's weird, I don't like the arrow functions in es6. And, I'm a coffeescript guy. I just don't like that the syntax is conditional on so many different things. The number of parameters, line length, etc... I just wrote this function and used `function` rather than `=>` because I couldn't get the syntax right using an arrow function: const showTable = ["email", "phone", "website"].reduce( function (previous…
["email", "phone", "website"].reduce(
(previous, channel) => previous || !!institution[channel] && !/^\s*$/.test(institution[channel]),
false
);
But I'd prefer the more readable: const hasNoEmail = /^\s*$/.test(institution.email || '');
const hasNoPhone = /^\s*$/.test(institution.phone || '');
const hasNoWebsite = /^\s*$/.test(institution.website || '');
const hasAny = !(hasNoEmail && hasNoPhone && hasNoWebsite);Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#47My code runs on Node >6.9.1 so it's really a no-brainer. The synthax is clearly superior.
You know what's weird, I don't like the arrow functions in es6. And, I'm a coffeescript guy. I just don't like that the syntax is conditional on so many different things. The number of parameters, line length, etc... I just wrote this function and used `function` rather than `=>` because I couldn't get the syntax right using an arrow function: const showTable = ["email", "phone", "website"].reduce( function (previous…
const showTable = ["email", "phone","website"]
.reduce((previous, channel) => { return previous || !!institution[channel] && !/^\s*$/.test(institution[channel])
}), false)
You can always just replace function() {
with () => {
and the only difference between the two would be binding this. Or you could do this: const showsTable = ["email", "phone", "website"]
.reduce((previous, channel) => previous || !!institution[channel] && !/^\s*$/.test(institution[channel]), false)Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#48Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#49Re: Ask HN: If you targetting ES6 by default, how did you rationalize that choice?
#50My code runs on Node >6.9.1 so it's really a no-brainer. The synthax is clearly superior.
You know what's weird, I don't like the arrow functions in es6. And, I'm a coffeescript guy. I just don't like that the syntax is conditional on so many different things. The number of parameters, line length, etc... I just wrote this function and used `function` rather than `=>` because I couldn't get the syntax right using an arrow function: const showTable = ["email", "phone", "website"].reduce( function (previous…