How can I tell whether a deep-seated key exists in an object in js?

for example, the value I finally want to get is a.b.c.d.e , when the data structure is fixed:

    Is there a more elegant way to write
  1. except for judging step by step, a & a.b & & a.b.c & & a.b.c.d ?
  2. if one of these levels is an array, for example, I need a & A.B & & a.b.c & & a.b.c [0] in this case
Nov.27,2021

js object gracefully take a depth value? you can refer to


technically, if the following code appears multiple times in the code, try using a function instead.

  

your question is too broad.
but one thing is that the existence of deep-seated key can only be judged step by step (recursively)

Menu