Suppose we are only given
var obj = {}; var propName = \"foo.bar.foobar\";
How can we set the prop
I know it's an old one, but I see only custom functions in answers. If you don't mind using a library, look at lodash _.set and _.get function.