Tips

Tips and Tricks

2022/06/27 (增加連結)

Tips

3D

API

Array

Console

Closure

Date

Observer

Object

  • Are JavaScript Object Properties Ordered?

    • When an object’s property keys are a combination of the above types, the object’s non-negative integer keys (enumerable and non-enumerable) are first added to the array in ascending order, then String keys are added in insertion order. Finally, Symbol keys are added in insertion order.

Proxy

Request

Scope

Editor

LocalStorage

Mail

PDF

DOM

Test

Flow

Build tools

Package

Frameworks

Remix

Performance

Web Worker

Lazy Loading

Caching

Clean code

ESLint

Polyfill

  • Polyfills, Ponyfills, and Transpiling

  • Compiling vs. Polyfilling in JavaScript

    • Compiling means the compiler (Babel) performs syntax transforms, but it does not add any new JavaScript primitives.

    • Able to be compiled

    • When you add a polyfill, you are adding brand-new functionality to your JavaScript code that did not exist there before.

    • Need to be polyfilled

      • ArrayBuffer

      • Array.from

      • Array.of

      • Array#find

      • Array#findIndex

      • Function#name

      • Map

      • Number.isNan

      • Object.assign

      • Object.entries

      • Object.values

      • Promise

      • Set

      • String#includes

      • Symbol

      • WeakMap

      • WeakSet