Suppose I have an object obj which has some variables in it. What I want to do is to add a new variable which has a name i gave as a parameter. For example:
var obj=
{
number:8
}
function AddField(field_name,obj)
{
//some magical code here
}
If I call
AddField('name',obj);
i want to be able to do
obj.name='Apple'
after calling this function.
Any ideas?