In this blog post, I show six tricks enabled by new ES6 features. At the end of each section, I point to related material in my book “Exploring ES6” (which is free to read online). Enforcing mandatory parameters via parameter default values # ES6 parameter default values are only evaluated when they are actually used. That lets you enforce that a given parameter be provided: /** * Called if a par
Last week I wrote about the yield return statement in c# and how it allows for deferred execution. In that post I explained how it powers LINQ and explained some non-obvious behaviors. In this week’s post I want to do the same thing but for Javascript. ES6 (ES2015) is becoming more and more mainstream, but in terms of usage I mostly see the more common arrow-functions or block-scoping (with let an
Show navigation The V8 team places great importance on the evolution of JavaScript into an increasingly expressive and well-defined language that makes writing fast, safe, and correct web applications easy. In June 2015, the ES2015 specification was ratified by the TC39 standards committee, making it the largest single update to the JavaScript language. New features include classes, arrow function
Intelligent AI Solutions for the Future Leveraging AI, we build intelligent systems that learn, evolve, and drive innovation, transforming industries for a smarter tomorrow. Big Data, Big Impact Leveraging advanced big data analytics, we transform complex datasets into actionable insights, fueling smarter decisions and shaping the industries of tomorrow.”
const areThey = 'Yes'; console.log(`${areThey}, they are`); // Logs: Yes, they are function strongValues(strings, ...values) { return strings.reduce((totalStr, str, i) => { totalStr += str; if (i in values) totalStr += `<strong>${values[i]}</strong>`; return totalStr; }, ''); } const areThey = 'Yes'; console.log(strongValues`${areThey}, they are`); // Logs: <strong>Yes</strong>, they are The synta
ES6 module loading: More complicated than you think Module JavaScript can be indistinguishable from non-module JavaScript. One of the most long-awaited features of ECMAScript 6 is the formal definition of modules as part of the language. For years, JavaScript developers have struggled with organizing their code and needing to decide between alternate ad-hoc module formats like RequireJS, AMD, and
This blog post gives tips for error handling in asynchronous, Promise-based functions. Operational errors vs. programmer errors # In programs, there are two kinds of errors: Operational errors happen when a correct program encounters an exceptional situation that requires deviating from the “normal” algorithm. For example, a storage device may run out of memory while the program is writing data t
Please note that this polyfill is now in maintenance mode, as of Jan, 2023. We are not planning to add more features or enhancements. This is a polyfill for the Proxy object, part of ES6. See the MDN docs or Introducing ES2015 Proxies for more information on Proxy itself. Unlike other polyfills, this does not require Object.observe, which is no longer supported anywhere. ⚠️ Note that Firefox, Chro
Presented at UtahJS 2015 and Fluent 2016 Disclaimer: a lot of the pictures were animated GIFs. That doesn't come through on SpeakerDeck
概要 インスタンスであるか判定するためのビルトインシンボルが実装された。 解説 instanceof演算子が「 obj instanceof C 」の形で使われると、「 C[@@hasInstance] 」が定義されていた場合objを引数に呼ばれ、それが返す真偽値が返される。 class X { } class A { static [Symbol.hasInstance](obj) { return obj.constructor == X } } let a = new A, x = new X console.log( a instanceof A ) // false console.log( x instanceof A ) // true ちょっと変わった利用例 型判定に使う const StringOrNumber = { [Symbol.hasInstance](v) {
A proposal to implement weak references in JavaScript – which would expose weak references made possible by WeakMap and WeakSet – is currently sitting at stage 0. Time for another ECMAScript proposal draft. This time we’ll discuss WeakRef. Weak references had their first – indirect – appearance in ES6, with the arrival of WeakMap and WeakSet. The Background and Intended Audience sections, found be
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く