My dilemma involves an object:
var myObject={};
accompanied by a function that appends values to the object:
function appendData(id, name){
//logic to validate id and name format, specify conditions for name being "John" and id being "I23423"
myObject.id = name;
}
However, the output consistently appears as:
myObject{
id="john"
}
What I actually desire is for the id to reflect whatever value the user inputs, resulting in:
myObject{
I23423="John"
}
Any suggestions on what adjustments should be made?