PDF完整版:https://github.com/huangjunsen/GooFlow/files/2078684/_.Issue.12.sdlddr_Gooflow.pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _asyncGenerator = function () { function AwaitValue(value) { this.value = value; } function AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; if (value instanceof AwaitValue) { Promise.resolve(value.value).then(function (arg) { resume("next", arg); }, function (arg) { resume("throw", arg); }); } else { settle(result.done ? "return" : "normal", result.value); } } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | |
function fn() { | |
var _data = data, | |
_data2 = _slicedToArray(_data, 1), | |
c = _data2[0]; | |
return c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
class Point { | |
getX() { | |
console.log(this.x); // C | |
} | |
} | |
class ColorPoint extends Point { | |
constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"sig":"32a34af259b837df4e02abb1a71bfefe6de6637a393fd3b6194a3578ede5fcb28306c9e1da1ba29ee71c3450331e960a946823525cef5eb8a8ada9a32de65f080","msghash":"f2f38ac068f4440b69248eea0bf2d8be85aa6eb9f233ca92239e28d721cbe188"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wtf() { | |
( [ {} ] ) | |
[ ( {} ) ] | |
{ ( [] ) } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript 字符串编码使用 UTF-16 | |
"💩".length === 2; | |
"💩" === "\u{1F4A9}"; // es6 | |
"💩" === "\uD83D\uDCA9"; // es5 | |
// 同一个编码可能使用不同的码位 | |
"ò" === "ò"; // ❎ | |
"ò" === "\xF2"; // ✅ | |
"ò" === "o\u0300"; // ✅ | |
"o\u0300".normalize("NFC") === "\xF2"; // ✅ es6 提供了 normalize 函数 |
OlderNewer