Opened 9 years ago
Closed 9 years ago
#14566 closed bug (notabug)
each function does not check object is iterable
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
$.each(obj, function(index, value){ alert(index); });
If obj is not an Array or not a String or not an Object, it will raise an error like "Uncaught TypeError: Cannot read property 'length' of undefined ".
I think before define "length=object.length" will check object type.
Note: See
TracTickets for help on using
tickets.
That would make debugging harder if we covered up mistakes. Pass in valid arguments.