A

  1. 不同的二叉搜索树
    数据公式的解法有点高级。

R

Understanding the ECMAScript spec, part 1 v8.dev

介绍了 ECMAScript spec 中的 [[ ]]、?、 ! 的使用含义。

  • 使用 [[ ]] 包含,表示的是 internal slotsinternal methods
  • 关于 ?? Foo() 等价于 ReturnIfAbrupt(Foo())

    1. // Return ? Foo() expands to:
    2. Let temp be Foo().
    3. If temp is an abrupt completion, return temp.
    4. Set temp to temp.[[Value]].
    5. Return NormalCompletion(temp).
  • 关于 !

    1. // Similarly, Let val be ! Foo() is equivalent to:
    2. Let val be Foo().
    3. Assert: val is not an abrupt completion.
    4. Set val to val.[[Value]].

文中给出了一个有意思的博客:https://timothygu.me/es-howto/ ,这个博客做的跟 w3c 规范的网站样式极其相似,按照 w3c 的“标准”来写博文,真是一个大佬!

T

My Favorite JavaScript Tips and Tricks Tapas Adhikary

下面列举个人觉得比较新的 Tips:

  • Number.isInteger(num) : 判断一个数是否是整数
  • event.target.valueAsNumber : 使用 event.target.value 获取 input 中的值通常返回的是一个字符串,而使用 event.target.valueAsNumber 可直接获取输入的数值
  • Required Function Params: 设置必填参数提示 ``javascript let isRequired = () => { throw new Error('This is a mandatory parameter.'); } let greetings = (name=isRequired(), message='Hello,') => { return${message} ${name}`; } console.log(greetings());
  1. - Swap variables 交换变量
  2. ```javascript
  3. let fire = '🔥';
  4. let fruit = '🍉';
  5. [fruit, fire] = [fire, fruit];
  6. console.log(fire, fruit);
  • Get Query Params: 获取地址栏参数:
    1. let project = new URLSearchParams(location.search).get('project');

S

推荐一本书:《如何阅读一本书》
image.png