You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
This blog post shows how you can use a tagged template to log variables more efficiently. In order to understand it, you should be familiar with ECMAScript 6 template literals and tagged templates. For an introduction, consult chapter “Template literals and tagged templates” of “Exploring ES6”. The problem: redundancy # If you want to log both name and value of a variable in a traditional manner,
When you have key-value data whose keys you don’t know in advance, it’s generally better to store it in an ES6 Map than in an object. But how do you convert Maps to and from JSON? This blog post tells you. Background knowledge: Maps: chapter “Maps” of “Exploring JavaScript” JSON: chapter “Creating and parsing JSON” of “Exploring JavaScript” Arbitrary Maps as JSON via Arrays of pairs # If a Map co
ECMAScript 6(2015年6月に公開され、今もなお比較的新しい JavaScript)の大目玉である イテレータ と ジェネレータ。なかなかに複雑で巨大な仕組みになっていてややこしいです。 そこで今回は イテレータ を、順を追って理解できるように解説したいと思います。 Qiita: JavaScript の イテレータ を極める!(この記事) Qiita: JavaScript の ジェネレータ を極める! また、実用的なサンプルを「3. 実用サンプル」に示しました。 初めにこちらを見て、何ができるのかを知ってから読み始めるのもオススメです。 (2017年3月現在、オープンなページでの使用はまだ避けたほうがいいかもしれませんが、実装は確実に進んでいます。ECMAScript 6 compatibility table) 1. ことばの定義 1.1. イテレータ (Iterator
The async functions are just around the corner – but the journey to here was quite long. Not too long ago we just wrote callbacks, then the Promise/A+ specification emerged followed by generator functions and now the asyncAsynchrony, in software programming, refers to events that occur outside of the primary program flow and methods for dealing with them. External events such as signals or activit
ES6 In Depth is a series on new features being added to the JavaScript programming language in the 6th Edition of the ECMAScript standard, ES6 for short. When I started on Mozilla’s JavaScript team back in 2007, the joke was that the length of a typical JavaScript program was one line. This was two years after Google Maps launched. Not long before that, the predominant use of JavaScript had been f
ECMAScript6 Style Guide - Frontend Team of GF Securities This style guide is based on standard specifications of JavaScript,only agreed for the ES6 related content Such as variable naming convention, whether to add a semicolon or not, please refer to JavaScript specification Note that the current code compiling tools ( such as Babel, Traceur) is not perfect , some features should be used with caut
Looping. You know the drill. You have a collection (i.e. an array or object) of something and you want to loop over the collection, gaining access to each individual thing or the index/key indicating where it is located in the collection. This is looping or "iteration." It's one of the core tasks of any language and, in JavaScript 2015 (aka ES6), it is getting an upgrade. In this article I am goin
This blog post helps you to get started with ECMAScript 6 (ES6): It explains how you can interactively try out ES6. It lists ES6 features that are easy to adopt, along with how those features are coded in ES5. Trying out ECMAScript 6 # There are three simple ways to play with ES6: Web browser: use the online Babel REPL, an interactive playground that compiles ES6 to ES5. There is nothing to insta
This one particular question is being often raised around the usage of the new ECMAScript decorators proposal: why can't I use it for regular function declarations? Well, the answer is simple: hoisting :( Since JS hoists up function declarations, those expressions that you use inside of decorators, depending on proposed "solution", might get hoisted up too, and thus break execution flow, or preven
ES6 In Depth is a series on new features being added to the JavaScript programming language in the 6th Edition of the ECMAScript standard, ES6 for short. Two weeks ago, we described the new classes system added in ES6 for handling trivial cases of object constructor creation. We showed how you can use it to write code that looks like this: <pre> class Circle { constructor(radius) { this.radius = r
ES6 In Depth is a series on new features being added to the JavaScript programming language in the 6th Edition of the ECMAScript standard, ES6 for short. The feature I’d like to talk about today is at once humble and startlingly ambitious. When Brendan Eich designed the first version of JavaScript back in 1995, he got plenty of things wrong, including things that have been part of the language eve
From Wikipedia: “A tail call is a subroutine call performed as the final action of a procedure.” return foo(); A tail call optimization may occur when the last thing to evaluate before a function returns is a function invocation. In certain circumstances, the interpreter can the reuse current stack frame for the function call instead of creating a new one. Below I will explain what circumstances a
RegExp.prototype.exec(str) # If /g is not set, matching always starts at the beginning, but skips ahead until a match is found. REGEX.lastIndex is not changed. const REGEX = /a/; REGEX.lastIndex = 7; // ignored const match = REGEX.exec('xaxa'); console.log(match.index); // 1 console.log(REGEX.lastIndex); // 7 (unchanged) If /g is set, matching starts at REGEX.lastIndex and skips ahead until a mat
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く