📜  instanceof vs typeof - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:18.750000             🧑  作者: Mango

代码示例1
For JS/TS:
instanceof checks the proptype chain and typeof compares against string literal labels.

- use instanceof for custom types
- use typeof for simple built in types
- Use instanceof for complex built in types

if in doubt go with instanceof, tbh