file called .htaccess is not filename "" and extension "htaccess" with a "." separating the two. .htaccess is a unix style dotfile. its whole name is ".htaccess" and it has no file extension.
You Can't JavaScript Under Pressure
61–70 of 110 posts
Re: You Can't JavaScript Under Pressure
#62What's everyone's times? I did 7 minutes
Blew through the first 4 but spent half my time on the last one because I don't have Javascript type checking memorized.
Re: You Can't JavaScript Under Pressure
#63I got 11 minutes and 14 seconds. Is that slow? The answer to my last solution was like this: function arraySum(i) { var total = 0 for(var x=0; x
That was also my final answer. However, I was going for speed and not elegance, after looking at other people's responses with prototypes and all.
Re: You Can't JavaScript Under Pressure
#64It's problems like 5 that make me sad that IE 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
#65Fun distraction. For me it was: 30% figuring out the answer, 20% not having my editor shortcuts available, 50% figuring out how to check if a value is a certain type. Am I the only one that gives their functions preconditions that the input is good? To me, throwing up when you're passed a non-number to a sum method is correct behavior.
Re: You Can't JavaScript Under Pressure
#66Fun 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…
Re: You Can't JavaScript Under Pressure
#67Fun distraction. For me it was: 30% figuring out the answer, 20% not having my editor shortcuts available, 50% figuring out how to check if a value is a certain type. Am I the only one that gives their functions preconditions that the input is good? To me, throwing up when you're passed a non-number to a sum method is correct behavior.
TIL there is no typeof === 'array'. -_-
Re: You Can't JavaScript Under Pressure
#68I got 11 minutes and 14 seconds. Is that slow? The answer to my last solution was like this: function arraySum(i) { var total = 0 for(var x=0; x
Re: You Can't JavaScript Under Pressure
#69It was a kinda cool thing, although I got some strange behavior when I was using `match` for determining whether the input is a filename - my regex was /. \.. / (and so I did var match = i.match(/. \.. /) ), and match[1] was undefined - turned out match[2] was what I wanted, and it was present, but the behavior was incorrect in the reporting console in the game. I finished this in 4 minutes. Edit: looks like HN doesn…
I thought regex was overkill for that one and used: return input.split(".")[1] || "";
Re: You Can't JavaScript Under Pressure
#70It was a kinda cool thing, although I got some strange behavior when I was using `match` for determining whether the input is a filename - my regex was /. \.. / (and so I did var match = i.match(/. \.. /) ), and match[1] was undefined - turned out match[2] was what I wanted, and it was present, but the behavior was incorrect in the reporting console in the game. I finished this in 4 minutes. Edit: looks like HN doesn…
I thought regex was overkill for that one and used: return input.split(".")[1] || "";