Length of a custom JavaScript Object
Today I was looking for a way to know how many nodes were in my JavaScript Object. Turns out JQuery has length property of size() function, but neither of them appeared to work with a complex custom Object of objects.
Turns out the following code will get you where you need to go:
Object.keys(obj).length
Where “obj” is your object name. Many thanks to the good folks at StackOverflow for getting down to the root of this problem for me.