// 设计一个函数 safeGet,可以对任意对象进行处理使其满足
const x = safeGet({
a: 'hello',
b: { d: 'world' },
c: [-100, 200, -300],
});
x.a() === 'hello'
x.b.d() === 'world'
x.c[0]() === -100
x.c[100]() === undefined
x.c[100](1234) === 1234
x.c.map((e) => e()) === [-100, 200, -300]
x.d.e() === undefined
x.d.e('optional default value') === 'optional default value'
x.y.z.a.b.c.d.e.f.g.h.i.j.k() === undefined
function safeGet(data) {
// write code here
}