Reputation: 10123
After reading this SE Discussion a question pops up. Why jquery defined two methods for the same purpose? Is there any purpose I missed?
Don't know this belongs to a wiki discussion. If so please guide me to change this so.
Upvotes: 1
Views: 109
Reputation: 322492
I would guess someone just didn't think it through, unless perhaps the earliest versions had some reason. I could only find source back to .1.2.6
, and it is unchanged from the current version
EDIT: It seems to have been unchanged since version 1.0.1.
The documentation for .size()
suggests that it should not be used.
You should use the .length property instead, which is slightly faster.
Upvotes: 1
Reputation: 47290
"most likely implemented to abstract away from the possibility of the length property being changed"
Upvotes: 0