chaining.js 264 Bytes
export const optionalChaining = (obj, ...rest) => {
  return rest.reduce((newObj, key) => newObj?.[key], obj) || ''
  //   let tmp = obj
  //   for (const key in rest) {
  //     const name = rest[key]
  //     tmp = tmp?.[name]
  //   }
  //   return tmp || ''
}