Execute a function or get a property on an object or instance from a given string in javascript