The malicious Browsealoud script "mines" or solves mathematical problems to generate Monero virtual currency units; in other words, the miscreants use your computing power, and your electricity, to make money.
While in this case the damage was limited to increased power usage - which might have shortened battery life on laptops - it could've been much, much worse.
Javascript powers much of the worldwide web, and it's a very powerful programming language.
If an attacker knows what s/he is doing with Javascript code, it's possible to do a vast array of bad things with users often having no idea what's happening.
There's even been Javascript proof of concept attacks written to exploit the very low-level Meltdown and Spectre security vulnerabilities that plague Intel and AMD processors (so please remember to update your browsers to the latest, patched versions).
However, at any given time, there will be vulnerable systems out there, so this problem isn't going to go away as the attackers have financial motives to spread malware.
The reason we're in this situation is the same old story of adding features and allowing anyone on the internet to do whatever they like with them, and then going "oops, we should've thought of security as well" after masses of computers are infected.
Yes, there are technical security measures including using digitally signed code to prevent a compromised variety from running and doing damage. Even then, that so many sites served up the compromised code shows administrators don't understand how to make their sites secure for users.
That has to and will change, as there will be consequences for failing to take precautions to keep web visitors safe.
If your business has an online presence, be very careful with what is served up to users.
Audit the site and the code on it, to understand what it does. If you can't do it yourself, pay someone who knows how to update and secure things for you. This isn't even new advice, so please take heed of it now.