Optional Chaining
Hey!
I am Dustin Savery
Senior Developer at GoDaddy
You can find me at @dustinsavery
2
And it’s not just me, this proposal has had nearly
2500
unique views in the last 2 weeks alone!
3
You ever wonder why we’re here?
Very brief refresher of Optional Chaining
4
Simply put, Optional Chaining is syntactic sugar for finding a value in a tree-like structure
5
“
But… why?
6
What is optional chaining?
const a = { b: { c: 42 }};
// With Optional Chaining
a?.b?.c
// Without Optional Chaining
a == null ? undefined : a.b == null ? undefined : a.b.c
7
What Optional Chaining is NOT
8
What does this proposal support?
const a = { b: 42 };
// Static Property Access
const x = a?.b;
// Dynamic Property Access
const y = a?.[‘b’];
9
What does this proposal NOT support?
10
It hasn’t been without controversy
11
So where do we go from here?
12