2 ms·
What do you mean by this? Do maps in JavaScript have some kind of pattern matching?
by __jonas 2y ago
What do you mean by this?
Do maps in JavaScript have some kind of pattern matching?
- munificent 2y agoJavaScript 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.