If I do console.log(myObject)
the result like this :
I want to calculate the length
I try myObject.lenght
, but it does not work
How can I solve this problem?
Seems this must convert first to normal object
If I do console.log(myObject)
the result like this :
I want to calculate the length
I try myObject.lenght
, but it does not work
How can I solve this problem?
Seems this must convert first to normal object
In JS, objects don't have a length
property, you can use the Object.keys(--your desired object--)
and get its length like this Object.keys(myObject).length
. I hope it helps.
Object.keys
will return an array containing all the keys in your object, which you must pass as parameter.
Get the length of this array instead.