Operators for Objects

Use . when the key is a valid identifier and [] for any expression or a key with spaces. typeof returns "object" for non-function objects (and, famously, for null). === compares references, so two objects are equal only if both point to the same object in memory. instanceof checks the prototype chain, in checks whether a key exists (own or inherited, so "toString" counts), and optional chaining ?. yields undefined instead of throwing when the left side is null or undefined.

Bracket access, typeof, ===, instanceof, in and ?.JavaScriptLive
const book = { title: "Dune", "page count": 412, author: { name: "Frank Herbert" } };
console.log(book["page count"], typeof book, typeof null, book instanceof Object);
console.log(book === { ...book }, "title" in book, "toString" in book);
console.log(book.publisher?.name, book.publisher?.name ?? "unknown");