How To Check a Value is Object in Javascript

Posted on 2/20/2024

In javascript you can check a value is object with this way

typeof yourVariable === "object" && yourVariable !== null;

Note: In Javascript null is considered as an object. So you must include yourVariable !== null.

Sources:

Created with ❤️ using Next.js & Tailwind CSS