class:
class MyComponent extends React.Component {
/* Adding state and binding custom methods */
constructor() {
super()class:
class MyComponent extends React.Component {
/* Adding state and binding custom methods */
constructor() {
super() 变量:名字(identifier) + 值(类型)
基础类型:栈里分配。(栈==函数调用栈)
引用类型:堆里分配。
作业:
1. 闭包与作用域:https://lucifer.ren/fe-interview/#/topics/js/scope&closures
2. 引用和操作符优先级
3. this
| /** | |
| * RuntimeGlobalsChecker | |
| * | |
| * You can use this utility to quickly check what variables have been added (or | |
| * leaked) to the global window object at runtime (by JavaScript code). | |
| * By running this code, the globals checker itself is attached as a singleton | |
| * to the window object as "__runtimeGlobalsChecker__". | |
| * You can check the runtime globals programmatically at any time by invoking | |
| * "window.__runtimeGlobalsChecker__.getRuntimeGlobals()". | |
| * |
| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
| class BrowserDetector { | |
| constructor() { | |
| // 测试条件编译 | |
| // IE6~10支持 | |
| this.isIE_Gte6Lte10 = /*@cc_on!@*/false; | |
| // 测试documentMode | |
| // IE7~11支持 | |
| this.isIE_Gte7Lte11 = !!document.documentMode; |
| // multi-part | |
| // client.mjs | |
| import fs from "fs"; | |
| import path, { dirname } from "path"; | |
| import request from "request"; | |
| import { fileURLToPath } from "url"; | |
| var r = request.post("http://localhost:7001/low-code/api/v1/magic", function( | |
| err, |
| // 根据 traceId 可以找出一个链路的所有请求 | |
| // 根据 spanId 可以就上面找到的所有请求画出调用树🌲 | |
| function a({ traceId, spanId, random }) { | |
| if (random > 0.5) { | |
| b({ traceId, spanId: spanId + "." + 1, random: Math.random() }); | |
| } else { | |
| c({ traceId, spanId: spanId + "." + 1, random: Math.random() }); |