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"); }); // ssss--------------------------------------------------- // test console.log( [ {}, [], /./, new Date(), function f() {}, (x) => 3, new Set(), new Map(), new WeakMap(), new WeakSet(), function* () {}, (function* () {})(), JSON, Math, Error(), new Promise(() => {}), ].every(xah_is_obj), ); console.log( [null, 3, 1, Infinity, NaN, "", true, undefined, Symbol()].every((x) => xah_is_obj(x) === false ), );
JavaScript, Value Types
JavaScript, Object and Inheritance
- JS: Object Tutorial
- JS: Object Overview
- JS: Object Type
- JS: Test is Object Type 🚀
- JS: Determine Type of Object
- JS: Prototype and Inheritance
- JS: Prototype Chain
- JS: Object.prototype.isPrototypeOf
- JS: Get Set Prototype
- JS: Show Prototype Chain 🚀
- JS: Create Object
- JS: Object Literal Expression
- JS: Create Object with Parent X
- JS: Prevent Adding Property
- JS: Deep Copy Object, Array 🚀
- JS: Test Object Equality 🚀
- JS: Add Method to Prototype
- JS: Object Object
- JS: Object Constructor
- JS: Object.prototype