Javascript is just the language. Its your runtime environment (browser) that is letting an unprivileged process consume resources like that without killing it.
I would argue that all modern Operating Systems have dark corners and hidden bugs. It is just a question of time until you hit a similar bug on any OS.
I had a similar experience on macOS with Chrome Canary watching a YouTube movie full screen. My laptop simply froze, nothing, except a restart, worked.