How to judge a.b.c in js? when getting attribute c, you need to nest to determine whether it is empty or not, in c-sharp? Grammar is fine. Is there a more convenient way to write it in js?

how to judge a.b.c in

js. When getting attribute c, you need to nest to determine whether it is empty or not. In c-sharp? Grammar is fine. Is there a more convenient way to write it in js?

Feb.28,2021

https://codeshelper.com/q/10.
refer to this answer


you can wrap it directly with try-catch , otherwise it can only be nested or & & . The second one looks like this

.
if(a.b && a.b.c) {
  // Do something here
}

is not A.B & & a.b.c | | 'default'
but what are the values that you say are empty?

Menu