It's rare (in my experience) to see the in operator used in JS — or at least much less common than in other languages. Normally we'll see something along the lines of:
typeof window !== "undefined"vs.
"window" in globalThisI've learned that this is because they're not equivalent, and that using the latter pattern can lead to unanticipated results in vanilla JS, particularly when undefined is involved:
a = {b: undefined}
"b" in a // returns True
typeof a.b !== "undefined" // returns FalseBut! It's possible to begin leveraging in more safely in TypeScript with type guards in operator narrowing.