Bug Tracker


Ticket #11573 (closed bug: duplicate)

Opened 2 years ago

Last modified 2 years ago

[jQuery.each] gives wrong result when a object adds a property [length].

Reported by: moonsunfall@… Owned by:
Priority: low Milestone: None
Component: misc Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:


var testEachObj = {length : 2}; $.each(testEachObj, function(key, value){

console.log('key = ' + key); console.log('value = ' + value);


the firebug logs: key = 0 value = undefined key = 1 value = undefined

expect log should be: key = length value = 2

Change History

comment:1 Changed 2 years ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to duplicate
  • Status changed from new to closed
  • Component changed from unfiled to misc

comment:2 Changed 2 years ago by sindresorhus

Duplicate of #7260.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.