3 ms·
JavaScript supports destructuring lists and objects (sort of like maps): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructur
by munificent 2y ago
JavaScript supports destructuring lists and objects (sort of like maps):
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
It's not full pattern matching because as far as I know they don't support refutable patterns, but it handles destructuring and binding to variables.
- __jonas 2y agoah, it didn’t occur to me to view destructuring as pattern matching but I guess it is a bit similar.