let book = { name: "Harry Potter 1", price: { value: 50, currency: "EUR" }, ISBN: "978-7-7058-9615-2", weight: { version1: { value: 550, unit: 'g' }, version2: { value: 690, unit: 'g' } } } if (book && book.weight && book.weight.version2 && book.weight.version2.value) { //Do something with book.weight.version2.value console.log(book.weight.version2.value); } if (book && book.weight && book.weight.version3 && book.weight.version3.value) { //Since there is no version 3, this block would not run and throw any errors console.log(book.weight.version3.value); } //Accessing without checking console.log(book.weight.version3.value); //error