JS: Test is Object Type 📜
/* xah_is_obj(x) return true if x is object type. Version: 2023-01-17 */ const xah_is_obj = (x) => { const yy = typeof x; return (x !== null) && (yy === "object" || yy === "function"); }; // s------------------------------ // test [ {}, [], /./, new Date(), function f() {}, (x) => 3, new Set(), new Map(), new WeakMap(), new WeakSet(), function* () {}, (function* () {})(), JSON, Math, Error(), new Promise(() => {}), ].forEach((x) => { console.assert(xah_is_obj(x) === true); }); [null, 3, 1, Infinity, NaN, "", true, undefined, Symbol()].forEach((x) => console.assert(xah_is_obj(x) === false));
JavaScript. Value Types
JavaScript. Object and Inheritance
- JS: Object (basics)
- JS: Object Overview
- JS: Object Type
- JS: Test is Object Type 📜
- JS: Find Object's sub-type
- JS: Prototype and Inheritance
- JS: Prototype Chain
- JS: Object.prototype.isPrototypeOf
- JS: Get Set Prototype
- JS: Show Prototype Chain 📜
- JS: Prototype Tree
- JS: Dot Notation and Prototype Chain
- JS: Create Object
- JS: Object Literal Expression
- JS: Object.create
- JS: Object Literal Expression vs Object.Create
- JS: Create Object with Parent X
- JS: Prevent Adding Property
- JS: Deep Copy Array or Object 📜
- JS: Test Equality of Array and Object by Content 📜
- JS: Add Method to Prototype
- JS: Object (class)
- JS: Object Constructor
- JS: Object.prototype