Simple, quick, question.
How can I create dynamically create keys in javascript associative arrays? All the doc I've found so far is to update keys that are already created:
arr['key'] = val;
I have a string like this " name = oscar "
And I want to endup with something like this:
{ name: 'whatever' }
That is I split the string and get the first element, and I want to put that in a dict ( asoc arr ).
EDIT
This is what I have and currently doesn't work ( I guess :S )
var text = ' name = oscar '
var dict = new Array();
var keyValuePair = text.split(' = ');
dict[ keyValuePair[0] ] = 'whatever';
alert( dict ); // prints nothing.
EDIT 2
Aaarggg. I hate re-take a programming languages. I forget the most basic things. It turns out I was filling the dict correctly but didn't knew how to display the values :-B . ... . Thank you all