In research I am trying to find the fastest way to determine if a object has values and a for can be executed on the object. REF: https://jsperf.com/jquery-each-vs-each-vs-for-loop/2
I used to do this, but in a discussion with a coworker he was using .each and we looked it up together and discovered that both methods are slow and in need of improvement.
if(Object.keys(X).length > 0) {
// Execute For
}
Here is what I know:
obj instanceof Object
and
typeof(obj) == "object" and obj !== "null"
because null is an object, both have their draw backs, but perhaps there is another more superior method.