JS Culprits
Type Erosion
Avoid instanceof to check types with, especially if an object is coming from another library.
The type might be removed somewhere easily e.g. {... obj}—same object without the type info.
Equality Comparison
Always use strict equality (===) instead of loose equality (==). Loose equality performs type coercion which can lead to unexpected results: