new method for counting array/obj length