check if function instanceof vs typeof code example
Example: instanceof vs typeof
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