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

Number#toFixed や Math.round/floor/ceil を駆使して表示用の値を整形することってないでしょうか。カンマ区切りをオレオレユーティリティ関数で実装したりそういったことを実現するライブラリを探したことはないでしょうか。 ほとんどの JavaScript の実行環境にはIntlという i18n のためのオブジェクトが組み込まれており、その中の1つにIntl.NumberFormatというクラスがあります。 オプションが色々あり、かなり便利で多機能なんですが整理された情報が少なく、身の回りで使用してる人も少ないと感じました。 Do you use Intl.NumberFormat? — れこ (@L_e_k_o) February 25, 2019 (2019/03/04あたりに結果表示されると思います。途中経過を見る場合元ツイートに飛んでください。) 「それ自
以前にMozillaのJavaScript実行エンジンの独自拡張機能である__noSuchMethod__をES6 Proxyで代替する方法をご紹介しましたが、その応用となる話です。 Proxyの制限事項 Proxyは任意のオブジェクトに対するプロパティアクセスやメソッド呼び出しなどの操作にフックを仕掛けたり動作をオーバーライドしたりするための汎用的な仕組みです。 しかし、何でも出来るわけではなく、仕様上で定義されている制限事項もあります。 具体的には、変更が禁止されたオブジェクトのプロパティアクセスに対しては、元と異なる値を返す事ができません。 var myObject = { hello: function() { return 'Hello!'; }, bye: function() { return 'Bye!'; } }; alert(myObject.hello()); //
Show navigation Several proposals expand the existing JavaScript class syntax with new functionality. This article explains the new public class fields syntax in V8 v7.2 and Chrome 72, as well as the upcoming private class fields syntax. Here’s a code example that creates an instance of a class named IncreasingCounter: const counter = new IncreasingCounter(); counter.value; // logs 'Getting the cu
はじめに はじめに 使い方 書式について UnicodePropertyName General_Category Script, Script_Extensions Binary Unicode property 調べ方 UnicodePropertyValue に属する文字一覧を調べる ある文字に指定されている属性を調べる おわりに 参考にした記事 ES2018で正規表現まわりの機能にいくつかの便利な表現が入った。 例えばこんな感じ。 いずれもChrome*1 のコンソールで入力して試すことができる。 // `ひらがな` のみの文字列ならtrue /^\p{sc=Hiragana}+$/u.test('あいうえお') // true // `カタカナ` のみの文字列ならtrue /^\p{sc=Katakana}+$/u.test('アイウエオ㍑㍍') // true // `漢字`
結果はどうなったでしょうか。 自分が今使っているGoogle Chromeだとこうなりました。 結果は{a: 10}というオブジェクトです。まあ、これは当然ですね。3 + 5と入力すれば実行されて8が返ってくるのですから、{a: 10}というオブジェクトリテラルを書けば{a: 10}というオブジェクトが作られるのは当然です。 ……。 ここで、一部の人は「おいふざけんなよ」と思っているかもしれません。というのも、この例は環境によっては違う結果になるのです。具体的には、Chrome以外2のブラウザのREPL(FirefoxやEdgeなど)が該当します。あと、ts-nodeのREPLも該当するらしいです。これらの環境では、結果は{a: 10}ではなく次のようになります。 オブジェクトを作ったはずなのに結果が10とか意味不明ですね。そもそも、こんな簡単なプログラムで結果が全然違うとか、JavaSc
Today we’re launching Test262 Report to provide JavaScript developers with up-to-date information on the state of new and existing language features across implementations. Test262 Report is based on daily runs of Test262, the ECMA-262 (“ECMAScript” or “JavaScript”) test suite, in nightly builds of JavaScript engines, and visualizes at-a-glance status of feature implementation progress. Taking a l
This post is part of my Today I learned series in which I share all my web development learnings. Today's learning surprised me! I was reading Twitter and came across a thread started by Sebastian McKenzie. In this thread, he shared a React snippet that would rely on the order of specific properties in an object. styles({ backgroundBlue: true, backgroundRed: true }); In the snippet above the backg
Show navigation BigInts are a new numeric primitive in JavaScript that can represent integers with arbitrary precision. With BigInts, you can safely store and operate on large integers even beyond the safe integer limit for Numbers. This article walks through some use cases and explains the new functionality in Chrome 67 by comparing BigInts to Numbers in JavaScript. Use cases #Arbitrary-precision
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く