Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Javascript arrays undefined values

I have some code that produces undefined values in an array making no sense.

here is the code:

gcc_py = 8;
gcc_pyd = 12;
var aci = 360/gcc_pyd;
var parcalar = new Array();
var renkler = new Array();
for(var i = 0;i<gcc_pyd;i++){ 
 parcalar.push(aci);
 renkler.push('#000');
}
console.log(parcalar);
console.log(renkler);

console.log(parcalar) outputs this:

[ Object , Object , Object , Object , Object , Object , Object , Object , Object , Object , undefined ×ばつ 2]

do you have any idea for the undefined values in the array?

Answer*

Draft saved
Draft discarded
Cancel
1
  • My console outputs it as an array of objects do you have any idea for that? Commented Jun 21, 2012 at 18:18

lang-js

AltStyle によって変換されたページ (->オリジナル) /