var myObject = {
    sub: {
        myFunction: function() {
            console.log('check');
        }
    }
}
var callFn = 'sub.myFunction'; // I want it to solve it here, whats going wrong?
myObject[callFn](); // Works, but not with 'sub.myFunction'
myObject.sub.myFunction(); // This works ofc.
I need a generic solution. Can someone explain why the sub.myFunction does not work? Does anyone have a workaround to solve this?
 
     
    