Live data from Hacker News

You Can't JavaScript Under Pressure

toys.usvsth3m.com

81–90 of 110 posts

Re: You Can't JavaScript Under Pressure

#81
I took almost 40 minutes, am I in the wrong profession? I figured out how to do all of them right away but I got stuck on figuring out JS syntax in a few places since I barely ever use it and felt like googling was cheating. I did use google on the last one to see how to check if something's an array. I even ended up checking at one point if something's a number by (!isNaN(n/4) && n+n == 2*n), and checked for being a string or not with if(s.length!=undefined) (I know that returns true for an array as well). Would've been a lot easier with something like Intellisense - coding without it feels almost like I'm blind, after being used to it. That and I thought alert() didn't work until I noticed at the end it actually sent it to the output.

Re: You Can't JavaScript Under Pressure

#82
post #26

Fun 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'. -_-

    [] instanceof Array; // returns true

Re: You Can't JavaScript Under Pressure

#84

The sudden music/talking that started was annoying and caused me to close the tab immediately.

No NoScript?

Maybe I'm naive but... I suspect that the rest of the page wouldn't have worked with NoScript. Since you're, you know, typing in JavaScript code and running it against some test cases.

Re: You Can't JavaScript Under Pressure

#85

Earlier quoted context omitted.

I love how you're mocking HN and the parent post at the same time!

I'm actually not mocking either the post or HN. If I am being a little snarky, it is towards the thin skinned who zero in on any comment they don't like and then launch a tirade in hopes of, essentially, group bullying. It happens with increasing regularity.

I actually find it refreshing when people mock or criticize HN on HN. There is too much orthodoxy here, too much defensiveness when that orthodoxy is questioned, too much indirection where a plainly stated opinion would suffice, and a lot of people don't have a sense of humor about themselves. (Watch this get downvoted by people proving exactly my point.)

Re: You Can't JavaScript Under Pressure

#87
post #49

I 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

You must've total+= arraySum(i[x]) right? Otherwise this couldn't work as the result of a deep dive wouldn't be utilized anywhere...

Yeah, I did, thanks for pointing that out. I made that mistake when writing the comment.

Re: You Can't JavaScript Under Pressure

#89

there's a truly dubious test case in the File Extension test. 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.

I have to admit to cheating and putting 'if (i === '.htaccess') return 'htaccess';' to save time :)

Re: You Can't JavaScript Under Pressure

#90

Earlier quoted context omitted.

No NoScript?

Maybe I'm naive but... I suspect that the rest of the page wouldn't have worked with NoScript. Since you're, you know, typing in JavaScript code and running it against some test cases.

I am using Noscript and the page works fine:

- usvsthem is white-listed so Javascript runs, which is all that's strictly required.

- White-listed sites are still blocked from running plugins including . It's straightforward to override this on a plugin-by-plugin basis but I typically don't want to.

11:14. The 14 seconds were enough for the first two questions, but I find strings and array handling tough when switching languages.

Post reply on HN