can.size
Return the number of items in the collection.
@@can.size()
The @@can.size
symbol points to a function that returns the number of
items in the collection.
const obj = {
[ canSymbol.for( "can.size" ) ]: function() {
return Object.keys( this ).length;
}
};
obj.foo = true;
obj.bar = true;
obj[ canSymbol.for( "can.size" ) ](); //-> 2
Returns
{Number}
:
The number of items in the collection.