// Less error-prone, but harder to read.letnameLength;if(db&&db.user&&db.user.name)nameLength=db.user.name.length;// Still checks for errors and is much more readable.constnameLength=db?.user?.name?.length;
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Also with v80, you can do optional chaining !