Before jQuery 1.8, we like use .size() to get array element count. But .size() method is deprecated as of jQuery 1.8. It’s better to use .length property instead. The reason is the .length property is public, and does not have the overhead of a function call.
So if the object is string type, .length will return sting length, and if it’s array type, it will return count of array elements.