Click the button to change the number of visible options in the dropdown list.
Try it ```htmljavascript - Array.size() vs Array.length - Stack Overflow
jQuery size() method vs length attribute - Stack Overflow
Difference between .length() and .length?
Differentiate between length and length()
Array.size() is not a valid method
Always use the length property
There is a library or script adding the size method to the array prototype since this is not a native array method. This is commonly done to add support for a custom getter. An example of using this would be when you want to get the size in memory of an array (which is the only thing I can think of that would be useful for this name).
Underscore.js unfortunately defines a size method which actually returns the length of an object or array. Since unfortunately the length property of a function is defined as the number of named arguments the function declares they had to use an alternative and size was chosen (count would have been a better choice).
.size() is not a native JS function of Array (at least not in any browser that I know of).
.length should be used.
If
.size() does work on your page, make sure you do not have any extra libraries included like prototype that is mucking with the Array prototype.
or
There might be some plugin on your browser that is mucking with the Array prototype.
I was practicing and came across something strange... when I wanted to find the character length of html inside a div I used
$('.count').text(function(){ return $('.words').text().length; });
which gave me a number (8 in this case) whereas using .length() didn't show anything. What is .length? I thought all methods had to have a () at the end? What is this black magic?