Twitter hashtag: #esspec
便利ツール
時事ネタ
TSKaigi Hokuriku
当選発表ありました
自己紹介 (近況報告)
syumai syumai.icon
Go / TSを書いて暮らしてます
フロントエンドカンファレンス東京がありました
今週はHono Conferenceがあります
Deep Trackという方の司会予定
オンラインもあります
先々週は万博行ってました
iwatsurut
とくに、イベントもなく過ごしています。
igrep(山本悠滋)
前回のあらすじ
20:39 再開
今回のメモ
code:js
const num = 12.34;
console.log("original", num);
console.log("undefined", num.toPrecision());
console.log(1, num.toPrecision(1));
console.log(2, num.toPrecision(2));
console.log(3, num.toPrecision(3));
/*
original 12.34
undefined 12.34
1 1e+1
2 12
3 12.3
*/
code:js
const num = Infinity;
undefined
num.toPrecision(10)
'Infinity'
. これはFULL STOPと呼ぶらしい
code:js
// MAX_SAFE_INTEGERを超えた整数は、結局Mathematical Valueに変換するところで値が失われているので、結局変わらない
BigInt(Number.MAX_SAFE_INTEGER + 1000000000000001)
10007199254740992n
BigInt(Number.MAX_SAFE_INTEGER + 1000000000000002)
10007199254740992n
BigInt(Number.MAX_SAFE_INTEGER + 1000000000000003)
10007199254740994n
BigInt(Number.MAX_SAFE_INTEGER) + BigInt(1000000000000003)
10007199254740994n
BigInt(Number.MAX_SAFE_INTEGER) + BigInt(1000000000000002)
10007199254740993n
BigInt(Number.MAX_SAFE_INTEGER) + BigInt(1000000000000001)
10007199254740992n
BigInt(Number.MAX_SAFE_INTEGER) + BigInt(1000000000000000)
10007199254740991n
code:js
BigInt.asIntN(4, 16n)
0n
BigInt.asIntN(4, 15n)
-1n
BigInt.asIntN(4, 14n)
-2n
BigInt.asIntN(4, 17n)
1n
BigInt.asIntN(4, 18n)
2n
BigInt.asIntN(4, 0n)
0n
BigInt.asIntN(4, 1n)
1n
BigInt.asIntN(4, 8n)
-8n
BigInt.asIntN(4, 9n)
-7n
BigInt.asIntN(4, 7n)
7n
BigInt.asIntN(5, 32n)
0n
BigInt.asIntN(5, 16n)
-16n
BigInt.asIntN(5, 17n)
-15n
BigInt.asIntN(5, 15n)
15n
code:js
BigInt.asUintN(4, 16n)
0n
BigInt.asUintN(4, 15n)
15n
BigInt.asUintN(4, 8n)
8n
BigInt.asUintN(4, 9n)
9n
BigInt.asUintN(4, 7n)
7n
code:js
Object.prototype.toString.apply(1)
Object.prototype.toString.apply(1n)
'BigInt'
'MyBigInt'
'BigInt'
Object.defineProperty(BigInt.prototype, Symbol.toStringTag, { value: "MyBigInt" })
Object.prototype.toString.apply(1n)