Not only because I can't find an appropriate subject line, but also because I can't find the issue with the following code (it's not jQuery related - I beg for mercy):
----------------------------------
var myThoughts =
{
   color:  'Blue'
   , name: 'Felix'
   , food: 'Lasagna'
}

var myMemory = {};

for (var i in myThoughts)
{
   myMemory[i] = function()
   {
       return this['thought'];
   }
myMemory[i]['thought'] = i+': '+myThoughts[i];
}

for (var j in myMemory)
{
   console.log('Remember: '+j);
   console.log('Result: '+myMemory[j].call(myMemory[j]));
}
----------------------------------

I would expect this to return the following:
----------------------------------
Remember: color
Result: color: Blue
Remember: name
Result: name: Felix
Remember: food
Result: food: Lasagna
----------------------------------

But instead I am getting:
----------------------------------
Remember: color
Result: food: Lasagna
Remember: name
Result: food: Lasagna
Remember: food
Result: food: Lasagna
----------------------------------

Tested this in FF 2.0 with the Firebug extension. I feel like I must have missed something embarrassing stupid, but I really need to know what it is ; ).

-- Felix
--
--------------------------
http://www.thinkingphp.org
http://www.fg-webdesign.de
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to