proposal-extensions
proposal-extensions copied to clipboard
Optional chaining for extensions -- `?::`
It would be great if optional chaining was baked into the proposal:
document.querySelector("#myElement")?::let(it => {
// it's safe to do things with the element here
setupInteractivity(it);
});
Equivalent to:
let temp = document.querySelector("#myElement");
if (temp != null) {
setupInteractivity(temp);
}