In JavaScript everything start with object. Object has vital role while working with JavaScript.
We define object with two curly braces like
const user={};
later can add key value pairs in it like
user.name="User"
user.email="[email protected]"
But mostly we have to check that object is empty or not. So let's check it
const user={};
console.log(Object.keys(user).length) // will log 0
user.name="User"
user.email="[email protected]"
console.log(Object.keys(user).length) // will log 2
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3