Given following array:
var arr = [undefined, undefined, 2, 5, undefined, undefined];
I\'d like to get the count of elements which are>
No, the only way to know how many elements are not undefined is to loop through and count them. That doesn't mean you have to write the loop, though, just that something, somewhere has to do it. (See #3 below for why I added that caveat.)
How you loop through and count them is up to you. There are lots of ways:
for loop from 0 to arr.length - 1 (inclusive).for..in loop provided you take correct safeguards....but it all amounts to looping, either explicitly or (in the case of the new array features) implicitly.