function myloadshGet(obj,path){
let defaultVal = undefined;
if(!Array.isArray(path)){
path = path.replace(/\[/g,".").replace(/\]/g,'').split('.');
}
console.log(path)
return path.reduce((o,k)=>{
return o[k]
},obj) ||defaultVal
}
let obj={
a:1,
b:2,
c:{
d:{
e:{
f:4
}
},
e:4
},
d:{
a:1
},
obj:{
a:1
}
}
console.log(myloadshGet(obj,'c[d].e'))