DEV Community

Discussion on: Chrome v80 release: JS module support for workers

Collapse
 
louis profile image
Louis Augry

Also with v80, you can do optional chaining !

// Less error-prone, but harder to read.
let nameLength;
if (db && db.user && db.user.name)
  nameLength = db.user.name.length;

// Still checks for errors and is much more readable.
const nameLength = db?.user?.name?.length;