This is more flash than Javascript - and has come up a few times, please read these from other posts I have made.
how to fix the firefox using max cpu problem
Yes, mine does it occasionally as well, it is a unacknowledged bug in the latest version of flash.
It doesn't take long to Google and find MANY other people with the same issue (Doesn't matter if you use Chrome, Firefox or IE).
I was browsing the Adobe forum recently and found a page linking to this. Adobe don't seem to support people on their own forums, but pay this company and monitor3complaints here!
I don't know what is causing it as I made a very intensive flash site and the CPU doesn't break a sweat where as a simple small advert on others causes 100% CPU as you report. When I installed Adblock Plus, it blocked these adverts and the CPU was normal.
It doesn't help though on some sites where there is needed flash which causes problems. I have no idea what features in flash actually cause this.
*I know it is flash because as a test I downgraded the version and the CPU never went above 30% on some pages then the moment I upgraded to latest, the same page just jumped to 100%
How to stop flash from raising my CPU temperature?
This is a problem with the latest few versions of Flash and I have written about it in many questions.
Your best bet is to use AdBlockPlus in Firefox.
I have no idea what causes this bug as I have created a few full Flash intensive websites and the CPU doesn't break a sweat, where as I can go on to Hotmail and see a tiny flash advert for some company and the CPU (well, the core) goes to 100%.
AdBlockPlus does a very good job at blocking all adverts and I have only run in to a single site where it blocked legitimate content, however all it took was a single click to show the page.
I would highly recommend it and I have not had a problem with high CPU since installing it.