TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Examples of everything new in ECMAScript 2016, 2017, and 2018

361 pointsby node-bayareaabout 7 years ago

18 comments

oneeyedpigeonabout 7 years ago
&gt; Trivia: the JavaScript spec people wanted to name it contains, but this was apparently already used by Mootools so they used includes<p>That sounds ... unfortunate, to say the least. Why is the language spec. beholden to one framework written in that language? Doesn&#x27;t mootools [1] check first for functions it might be overriding?<p>&gt; Emojis and other double-byte chars are represented using multiple bytes of unicode. So padStart and padEnd might not work as expected!<p>It&#x27;s a shame this isn&#x27;t followed up on. What&#x27;s the solution? Only use ASCII? Don&#x27;t use padStart&#x2F;padEnd? Does anyone know anything about monospace fonts and any guarantees they make wrt. unicode?<p>[1] <a href="https:&#x2F;&#x2F;mootools.net&#x2F;core&#x2F;docs&#x2F;1.5.2&#x2F;Types&#x2F;Array#Array:contains" rel="nofollow">https:&#x2F;&#x2F;mootools.net&#x2F;core&#x2F;docs&#x2F;1.5.2&#x2F;Types&#x2F;Array#Array:conta...</a>
评论 #16753921 未加载
评论 #16754467 未加载
评论 #16753876 未加载
评论 #16753917 未加载
评论 #16757546 未加载
hackcasualabout 7 years ago
Don&#x27;t get too excited for SharedArrayBuffer. Every major browser disabled it to help mitigate spectre, and there&#x27;s no current road map for re-enablement.
评论 #16750588 未加载
评论 #16750741 未加载
评论 #16750536 未加载
评论 #16750002 未加载
评论 #16752925 未加载
keyleabout 7 years ago
I&#x27;m surprised we don&#x27;t have the &#x27;safe navigation operator&#x27; yet in Javascript.<p>It would be very useful, especially in templating engines, complex VueJS views etc.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Safe_navigation_operator" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Safe_navigation_operator</a>
评论 #16750762 未加载
Avery3Rabout 7 years ago
Gigantic sticky header and footer and a huge font size? You can barely fit a single paragraph on the page, this is probably one of the worst website designs that I&#x27;ve ever seen.
评论 #16751041 未加载
评论 #16753641 未加载
评论 #16755385 未加载
评论 #16759823 未加载
评论 #16751202 未加载
Flimmabout 7 years ago
&gt; This is because ️ is two bytes long (&#x27;\u2764\uFE0F&#x27; )!<p>No, that&#x27;s not bytes. You&#x27;re counting code points. Because of the way Javascript works, it can&#x27;t accept code points greater than U+FFFF, so it has to use surrogate pairs.
评论 #16749455 未加载
ridiculous_fishabout 7 years ago
The ECMAScript spec is weird. One example: in ES5 RegExp.prototype was itself a RegExp, in ES6 it became not a RegExp but just an Object, and in ES7 it stayed an Object but all of the RegExp.prototype methods have to specially check if `this` is RegExp.prototype, thereby pretending to be a RegExp, without actually being one.<p>Why does the spec have this churn?
评论 #16754092 未加载
mrtksnabout 7 years ago
That’s nice, lately I start forgetting what’s ECMAScript and what’s Babel&#x2F;Webpack feature.<p>Sometimes it’s nice to have a refresh.
elmigrantoabout 7 years ago
Can someone please explain why for…of needed to be specialized for its async form?<p>I get why async generators &amp; iterators won&#x27;t work with plain for…of, but don&#x27;t get why following is invalid:<p><pre><code> for (const i of [1, 2, 3]) await getThingAtIndex(i); </code></pre> The very last example in the article uses similar code, but I feel iterating over array of promises misses the point (as opposed to actually receiving async iterator with `async next () {…}` via `Symbol.iterator`).<p>Or am I missing something here? Thanks.
评论 #16750921 未加载
评论 #16754758 未加载
jaequeryabout 7 years ago
i personally think javascript ECMAScript committee needs to take a break and chill for a bit. they are changing too fast. it&#x27;s to the point one forgets if a certain new syntax is available in the whatever version they are and need to check the manual several times. it was fine from es5, 6,7, but if this keeps up at this rate, it&#x27;s getting too much.
评论 #16752684 未加载
评论 #16753603 未加载
评论 #16757160 未加载
kristiandupontabout 7 years ago
I really don&#x27;t understand the need for the infix exponentiation operator. Maybe it&#x27;s because I just don&#x27;t do calculation heavy JS code but it seems like nothing but a clever little trick you can impress colleagues with. I would hate for JS to evolve towards needing something like <a href="https:&#x2F;&#x2F;www.ozonehouse.com&#x2F;mark&#x2F;periodic&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.ozonehouse.com&#x2F;mark&#x2F;periodic&#x2F;</a>
kuonabout 7 years ago
I see JS becoming more and more complex, while elm becomes more and more simple, yet it can do a lot.
collywabout 7 years ago
Fixed header and footer wastes enough screen space on a laptop that it makes it annoying to read.
dmixabout 7 years ago
&gt; Until now, if we want to share data between the main JS thread and web-workers, we had to copy the data and send it to the other thread using postMessage . Not anymore!<p>This would have been great for a complex Chrome web extension (Gmail &quot;AI&quot; plugin) I developed previously. It relied on quite a significant amount of postMessage&#x27;ing back&#x2F;forth where I had to create a hand-built queue system (on both ends) with redundancy and debugging. And even then I still had a endless series of race conditions and silently failing bugs that were difficult to debug :&#x2F;
collywabout 7 years ago
Question from a backend dev who need to do some JavaScript from time to time.<p>What version should I use? With backend stuff I am usually responsible for installing the versions of the code &#x2F; language &#x2F; libraries that I use. With browsers what can I reasonably expect users to have in their browser?
评论 #16753847 未加载
评论 #16753837 未加载
评论 #16754270 未加载
评论 #16755452 未加载
ceruleusabout 7 years ago
In the ES2018 section, there are 2 #8s.
wotbbcicxinuabout 7 years ago
Thanks. I didnt realize some of those 2018 examples just got in. Im really enjoying the object helpers
ransom1538about 7 years ago
Nice almost as good as PHP. I loved the whole get keys segment.
评论 #16751671 未加载
EtDybNuvCuabout 7 years ago
I am pleased to see that features from E continue to be smuggled into ES, like finally-style asynchronous cleanup and template literal enhancements.<p>Edit: Downvotes can&#x27;t undo our improvements to ES. We will drag JavaScript and its users, kicking and screaming, to a capability-secure future.
评论 #16751541 未加载
评论 #16751212 未加载
评论 #16760349 未加载