Looping over object values works as intended, but first value is undefined?
Could someone explain to me why objectInfo method on the t开发者_如何学JAVAhird button returns undefined for the first value? http://jsfiddle.net/PnSSX/11/
I can't figure out where this comes from, because there is no property before name...
Can you help? Am I missing something?
Best regards, shapeshifta
It's because loop
is initially undefined
and you're calling +=
so it gets a converted to a string, to fix it, change this:
var loop;
To this:
var loop = "";
You can see the updated/working version here.
精彩评论