在 npm 5.1 或者更低版本中,不存在 npx
命令。因此,你必须全局安装 create-next-app
:
npm install -g create-next-app
然后再运行:
create-next-app
// 需要通过 node --allow-natives-syntax 参数运行 | |
const { GCSignal, consumeSignals, trackGarbageCollection } = require("gc-signals"); | |
function fn() { | |
// 创建两个局部变量 | |
const a1 = new GCSignal(1); | |
const a2 = new GCSignal(2); | |
global.tmp = a2; // 将 a2 变量赋值给全局变量 | |
const o = {}; | |
trackGarbageCollection(o, 3); // 跟踪局部变量 o 的 GC 状态,标识为 3 |
在 npm 5.1 或者更低版本中,不存在 npx
命令。因此,你必须全局安装 create-next-app
:
npm install -g create-next-app
然后再运行:
create-next-app
%GetOptimizationStatus
return a set of bitwise flags instead of a single value,
to access the value, you need to take the binary representation of the returned value.
Now, for example, if 65
is returned, the binary representation is the following:
(65).toString(2).padStart(12, '0');
// 000001000001
Each binary digit acts as a boolean with the following meaning:
// JavaScript 字符串编码使用 UTF-16 | |
"💩".length === 2; | |
"💩" === "\u{1F4A9}"; // es6 | |
"💩" === "\uD83D\uDCA9"; // es5 | |
// 同一个编码可能使用不同的码位 | |
"ò" === "ò"; // ❎ | |
"ò" === "\xF2"; // ✅ | |
"ò" === "o\u0300"; // ✅ | |
"o\u0300".normalize("NFC") === "\xF2"; // ✅ es6 提供了 normalize 函数 |
function wtf() { | |
( [ {} ] ) | |
[ ( {} ) ] | |
{ ( [] ) } | |
} |
{"sig":"32a34af259b837df4e02abb1a71bfefe6de6637a393fd3b6194a3578ede5fcb28306c9e1da1ba29ee71c3450331e960a946823525cef5eb8a8ada9a32de65f080","msghash":"f2f38ac068f4440b69248eea0bf2d8be85aa6eb9f233ca92239e28d721cbe188"} |
let reslt, x; | |
reslt = [...null]; // TypeError: null is not iterable | |
reslt = [...undefined]; // TypeError: undefined is not iterable | |
reslt = {...null}; // {} | |
reslt = {...undefined}; // {} | |
if (x in null) {} | |
// TypeError: Cannot use 'in' operator to search for 'undefined' in null |
function test() { | |
const a = new Int32Array(10); | |
for (let i = 0; i < 1e6; i++) { | |
a.set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); | |
} | |
return a; | |
} | |
console.time('test'); | |
test(); |
// https://github.com/chaosbot/Chaos/blob/master/server/static/js/chaos.js | |
var canvas = document.createElement("canvas"); | |
document.getElementsByClassName("content")[0].appendChild(canvas); | |
var ctx = canvas.getContext("2d"); | |
canvas.width = 400; | |
canvas.height = 200; | |
ctx.fillStyle = "#000000"; | |
ctx.fillRect(0, 0, canvas.width, canvas.height); |