开发者

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜