Skip to content

Commit

Permalink
changed ?. to . as it was designed to cause a typeError
Browse files Browse the repository at this point in the history
  • Loading branch information
zsh77 committed Mar 7, 2023
1 parent 50ef836 commit 4726388
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ Most of these features already supported by some browsers and try out with babel
}
};

console.log(vehicle.car?.name); // TypeError: Cannot read property 'name' of undefined
console.log(vehicle.car.name); // TypeError: Cannot read property 'name' of undefined

console.log(vehicle.car?.name); // Undefined
console.log(vehicle.car?.speed); // Undefined
Expand Down

0 comments on commit 4726388

Please sign in to comment.