variable not being defined correctly
console.log('startX:'+startX,'startY:'+startY)
var pixelStack=[[startX, startY]]; //create pixel stack with starting pixel on top
console.log('pxStack:'+pixelStack)
var test=[[startX, startY]];
console.log('test:'+test)
pixelStack=test
console.log(pixelStack,test)
When I run this code (it's contained inside a function) test is define开发者_运维知识库d correctly, but pixelStack is defined as an empty array ([]), when i run pixelStack=test they both become an empty array. Here is my console output:
startX:250 startY:250
pxStack:250,250 test:250,250 [] []
(I'm in Google Chrome)
It Works For Me™
http://jsfiddle.net/raybellis/KLcPe/
精彩评论