Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13578 closed bug (notabug)

outputting arrays

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

Dear Sirs,

I got an unexpected result with the following code fragment:

$(document).ready(function() {
var colors = new Array("red","yellow");
var count = colors.unshift("black","white");
count = count.push("blue");
$('#30').click(function() {

$('#30a').text(colors);

});
var item = colors.shift();
$('#31').click(function() {

$('#31a').text(item + ", new length = "+colors.length);

});
})

When I click the button id = "30" I get the result "white,red,yellow,blue" , although it should be "black,white,red,yellow,blue". When I click the button id="31" I get the correct result "black" and the correct new length of the array: 4

I sincerely hope this e-mail deserves your attention.
With kind regards,
Rudy Van Impe

Change History (1)

comment:1 Changed 10 years ago by markelog

Resolution: notabug
Status: newclosed

Don't know what you trying to do here, but this erratic code is definitely not jQuery's fault.

Note: See TracTickets for help on using tickets.