Created
February 24, 2020 23:20
-
-
Save manakuro/2d1ce9ecb9663a72f1365326643ae44f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { | |
foo: { | |
bar: { | |
baz: 42, | |
}, | |
}, | |
}; | |
const baz = obj?.foo?.bar?.baz; // 42 | |
const safe = obj?.qux?.baz; // undefined | |
const fooValue = myForm.querySelector('input[name=foo]')?.value | |
// value or undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment