News for hackers. Stuff that matters.
Re:Tricks I wish I knew when I learned TypeScript by Fckd on Tuesday October 12, 2021 @08:02AM (#28838688)
x && !Array.isArray(x) && typeof x === 'object'.

its typical to start off with `var &&` to avoid operations on null & undefined values

Re:Tricks I wish I knew when I learned TypeScript by Fckd on Tuesday October 12, 2021 @08:28AM (#28838849)
For environment lacks Array.isArray method i think this works well

!!(x && x.__proto__ === [].__proto__)