How to Count the Number of Properties of the JavaScript Object

While working with JavaScript, I come across a requirement to count a number of properties in a JavaScript object. I found two ways to find the number of properties in an object. They are as follows:
Consider an object, “cat," as demonstrated below:

Link: https://dzone.com/articles/how-to-count-the-number-of-properties-of-the-javas?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev