In JavaScript object, we can
var myobj = {
    x: 0,
    y: {
        n: 6
    }
};
myobj['x'] = 6; // myobj.x will be 6
Can I do something like this with a function?—
myobj['y.n'] = 6;
I don't want use myobj.y.n.
In JavaScript object, we can
var myobj = {
    x: 0,
    y: {
        n: 6
    }
};
myobj['x'] = 6; // myobj.x will be 6
Can I do something like this with a function?—
myobj['y.n'] = 6;
I don't want use myobj.y.n.
 
    
     
    
    No, there is no built-in way to resolve this kind of object path. However, there are quite a few small libraries available for this such as goodwin.
Or you could implement it on your own. It's not really hard. Simply split the path string at . and then walk through the objects.
