开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜