tags:

views:

33

answers:

1

Hi there!

Could someone explain to me why objectInfo method on the third 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

+3  A: 

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.

Nick Craver
*smash head on keyboard*
shapeshifta
@shapeshifta - :)
Nick Craver
Thanks a lot!!! Did not see that, but it's so obvious... :D
shapeshifta
@shapeshifta - If it helps, I had to do a double take to see what was causing it as well :)
Nick Craver
Helps a bit, mate :) Take care!
shapeshifta