Under what circumstances in js, printing a value without an index in square brackets will not report an error?

for example:

var arr = ["image", "url"]
arr.forEach(key => {
  url = url[key]
})
console.log(url)

what type of numerical printing should this url be so that he will not report an error?

Jun.11,2022

Note: url is constantly accessed downwards in the code, which means that url must be an object

1. If arr has a lot of content, the value of url is meaningless.
2. If arr has only two values, then url is a secondary object, for example:

{
  image: {
     url: 'http://xxxx'
  },
}
Menu