Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What do you mean by this? Do maps in JavaScript have some kind of pattern matching?


JavaScript supports destructuring lists and objects (sort of like maps):

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.


ah, it didn’t occur to me to view destructuring as pattern matching but I guess it is a bit similar.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: