safe-get-attr
Safe-get-attr can help us quickly get attributes and ensure program robustness.
get
npm i safe-get-attr --save-dev
use
const Tom = name:'Tom' child: name:'Dick' child: name:'Jack' child: name:'Jerry' const name1 = // Jerry const name2 = // undefined but there's no error