SyntaxFix
Write A Post
Hire A Developer
Questions
myObj[prop] = value;
That should work. You mixed up the name of the variable and its value. But indexing an object with strings to get at its properties works fine in JavaScript.