---
title: "Discussion on \"JAVASCRIPT: Check if an Object exists and is not empty\" | Hashnode"
description: "Discussion on \"JAVASCRIPT: Check if an Object exists and is not empty\". To check if an object \"myObj\" exists ( it's neither null nor undefined) and it's not empty we can use this expression :\nmyObj \n&& \nObject.keys(myObj).length !== 0  \n&& \nmyObj.constructor === Object\nExplanation\n\nmyObj  if it evaluates to true,  \"myObj..."
url: "https://hashnode.com/posts/javascript-check-if-an-object-exists-and-is-not-empty/5f80e4b05841661b519d0010"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [JAVASCRIPT: Check if an Object exists and is not empty](https://papidev.hashnode.dev/javascript-check-if-an-object-exists-and-is-not-empty?utm_source=hashnode&utm_medium=feed)

To check if an object "myObj" exists ( it's neither null nor undefined) and it's not empty we can use this expression : myObj && Object.keys(myObj).length !== 0 && myObj.constructor === Object Explanation myObj if it evaluates to true, "myObj...

Oct 9, 2020 · 2 min read · papidev.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#objects](https://hashnode.com/tag/objects)
-   [#object](https://hashnode.com/tag/object)

## Written by

[Luca Zanzottera](https://hashnode.com/@Zanz)

@Zanz · Italy

  
[View profile](https://hashnode.com/@Zanz)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
