Oh! Hello. This is my thing I made for usvsth3m.com. Hope y'all like it. HTML5 Webworkers made it possible - sandboxing user-submitted JavaScript so an accidental while(1) or document.write can't kill everything. Do have a look at the source code. Oh, and try turning up your speakers and typing in the Konami code...
If you alert() something inside an infinite loop it doesn't seem to be able to detect it (nor does it show an alert box!)
You Can't JavaScript Under Pressure
41–50 of 110 posts
Re: You Can't JavaScript Under Pressure
#42 return i.reduce(function(prev, next) {
if (typeof(next) == "object" && next.length) { return arraySum(next) + prev; }
if (typeof(next) == "number") { return next + prev; }
return prev;
}, 0);
Something that simple needs to be shimmed on earlier IEs. In fact, I had to look up Array.prototype.reduce for this since I usually use Underscore's. Javascript problems...Re: You Can't JavaScript Under Pressure
#43Earlier quoted context omitted.
Because of your comment, HN will have a dozen "I am so disappointed in all of you" posts in the coming week declaring how mean everyone here is, and how it is no longer like it "once was". I hope you are happy.
I love how you're mocking HN and the parent post at the same time!
Re: You Can't JavaScript Under Pressure
#44Re: You Can't JavaScript Under Pressure
#45its like returning error codes in C for errors
Re: You Can't JavaScript Under Pressure
#46What's everyone's times? I did 7 minutes
Re: You Can't JavaScript Under Pressure
#47Re: You Can't JavaScript Under Pressure
#48Fun little puzzles. First 4 went pretty quickly (~8:00) and then the last one took ~7 minutes Googling around for this so I could test if a variable was an integer... n===+n && n===(n|0) Wish I could see my answers after the fact though! Edit: Read the initial requirements of the puzzle, it says sum all the integers , not all the numbers . People using (typeof i[x] == 'number') just got lucky because the test-cases d…
n % 1 == 0Re: You Can't JavaScript Under Pressure
#49 function arraySum(i) {
var total = 0
for(var x=0; x Re: You Can't JavaScript Under Pressure
#50What's everyone's times? I did 7 minutes