0xFrizen.eth pfp
0xFrizen.eth
@0xfrizen
The new `?=` operator in JavaScript is a true game-changer! JavaScript is set to handle async code more cleanly with this new Safe Assignment (?=) operator, introduced as a 2023 proposal in the ECMAScript community. This operator aims to streamline async code by reducing deep nesting and the need for bulky try-catch blocks, making your code more readable and easier to maintain. How It Works: The ?= operator allows functions to return a tuple [error, result]: - If an error occurs, it returns [error, null]. - If successful, it returns [null, result]. The Safe Assignment operator is still a proposal, so it's not part of the official ECMAScript specification. However, you can experiment with polyfills (though you'll need to use = instead of ?= for now). Developers are encouraged to get involved and contribute to the proposal's development. What do you think of the new ?= operator? Check out the proposal on GitHub: https://github.com/arthurfiorette/proposal-safe-assignment-operator
1 reply
1 recast
6 reactions