News for hackers. Stuff that matters.
Re:Show HN: A Repo of JavaScript Coding Challenges by dlo83 on Friday June 12, 2015 @02:07PM (#9707565)
This looks great. Rebecca Murphy's JS Assessment is also a good resource for testing your JavaScript chops:

https://github.com/rmurphey/js-assessment

Re:Show HN: A Repo of JavaScript Coding Challenges by kevin on Friday June 12, 2015 @06:43PM (#9709034)
Man, I really hope people contribute to this. It would be great to see the list of challenges with supposed difficulty level and expected amount of time needed to finish.

Someone should make a repo for testing designer skills as well. Thanks for sharing! This is really well done.

Re:Show HN: A Repo of JavaScript Coding Challenges by msoad on Friday June 12, 2015 @01:19PM (#9707260)
I'm interviewing for JS devs and trust me, none of ones I interviewed could write a _.debounce function. Async throttle for promises?! If we find someone who can understand the question she/he will be hired. They don't need to solve it!
Re:Show HN: A Repo of JavaScript Coding Challenges by nialo on Friday June 12, 2015 @02:09PM (#9707577)
I'm looking for work as a programmer, and I think I understand the throttle question and approximately what a solution would look like, although I would need research to actually write one. Debounce sounds easy though. I'd love to talk about your company and any opportunities you might have open, my email address is [email protected]
Re:Show HN: A Repo of JavaScript Coding Challenges by NathanKP on Friday June 12, 2015 @02:26PM (#9707667)
Are you hiring frontend JS devs or backend Node.js devs? If a backend dev doesn't understand the question and can't implement a basic debounce function then you are setting yourself up for a completely broken backend.

I've found that JS hiring in particular is very tricky because every frontend dev that has used a little jquery suddenly thinks they can create a server, which is completely inaccurate.

Interview questions like this can help you trim it down to the .5% who are actually capable Node.js devs.

Re:Show HN: A Repo of JavaScript Coding Challenges by savanaly on Friday June 12, 2015 @01:34PM (#9707351)
I did an interview where they asked me exactly that. I got to a solution, but it took over a half hour which was too long and I wasn't hired. I barely understood closures at that time though! Today I could some thing like that so quick...
Re:Show HN: A Repo of JavaScript Coding Challenges by 13years on Friday June 12, 2015 @01:28PM (#9707312)
Another great site of challenges can be found at http://codewars.com
Re:Show HN: A Repo of JavaScript Coding Challenges by epmatsw on Friday June 12, 2015 @02:36PM (#9707737)
I like their interface a lot, but I'm not sure how I feel about the challenges they actually have for JS. It seems like there's a lot of challenges that are trivially solvable with Array.prototype.map, and then a bunch more that are super complex and (for me at least) unsolvable. I wish there were more challenges in the middle :(
Re:Show HN: A Repo of JavaScript Coding Challenges by rmrfrmrf on Friday June 12, 2015 @02:00PM (#9707518)
It's cool that these challenges are so functional programming oriented, but I'd be a little bit concerned that the terminology might throw off some otherwise-skilled web developers who aren't used to operating at such a theoretical level. That problem would be compounded with definitions like "A thunk is basically a function that you call with just the callback as a parameter," in the challenge instructions (IMO that's a very layman definition for such a technical question).
Re:Show HN: A Repo of JavaScript Coding Challenges by lewisl9029 on Friday June 12, 2015 @08:21PM (#9709344)
HackerRank has a pretty good collection of multi-language challenges with a range of difficulties and problem domains to choose from:

https://www.hackerrank.com/

There's also a competitive aspect to it if you're into that kind of thing, but I personally just use it as a casual learning/interview prep tool.

Their functional programming collection has been especially invaluable for me for getting used to solving problems in a functional mindset.

Re:Show HN: A Repo of JavaScript Coding Challenges by BinaryIdiot on Friday June 12, 2015 @01:46PM (#9707422)
Hey those are pretty neat challenges! Personally I like tackling a project I'm interested in that requires many of these aspects but these are pretty handy if you want to quickly study or test a particular idea.

Edit: Glad to see an implementation of async.js in there as well; I feel like writing your own version is practically a rite of passage in JavaScript.

Re:Show HN: A Repo of JavaScript Coding Challenges by kdamken on Friday June 12, 2015 @01:23PM (#9707281)
Looking on working on upping my JS skills in the near future. This will be very helpful, thank you!
Re:Show HN: A Repo of JavaScript Coding Challenges by grumblestumble on Friday June 12, 2015 @07:06PM (#9709118)
This sucks, I still can't invert a binary tree!
Re:Show HN: A Repo of JavaScript Coding Challenges by ExpiredLink on Saturday June 13, 2015 @03:14AM (#9710187)
Just google it.
Re:Show HN: A Repo of JavaScript Coding Challenges by madflame991 on Friday June 12, 2015 @01:25PM (#9707295)
You can make an interesting challenge out any one of the bigger (in LOC) functions of underscore.js or any promise library. You get a profound "a-ha" moment the first time you implement `deepClone` or `Promise.all`
Re:Show HN: A Repo of JavaScript Coding Challenges by duaneb on Friday June 12, 2015 @01:41PM (#9707389)
I'm not super familiar with javascript, but are all copies shallow by default? Deep copies are trivial enough to bake into the language.
Re:Show HN: A Repo of JavaScript Coding Challenges by rmrfrmrf on Friday June 12, 2015 @02:16PM (#9707621)
JavaScript objects are always pass reference by value (i.e. you're passing around addresses copied by value which are then dereferenced when needed). Copying objects at all in JavaScript is therefore somewhat non-trivial, especially if you need good performance. Typically, the most performant way to deep-copy an object with an unknown structure is to do:

    var objCopy = JSON.parse(JSON.stringify(obj));
But that 1) is a rather disgusting hack and 2) can potentially break on certain native JS Objects (like Date, for example). The most straightforward way would be to use a for-in loop with a guard for Object.hasOwnProperty(), but in practice, that's very slow by comparison.
Re:Show HN: A Repo of JavaScript Coding Challenges by madflame991 on Friday June 12, 2015 @02:38PM (#9707742)
...and it gets even more interesting if you throw in a few circular references in there
Re:Show HN: A Repo of JavaScript Coding Challenges by kolodny on Friday June 12, 2015 @02:42PM (#9707771)
Re:Show HN: A Repo of JavaScript Coding Challenges by 0xCA1C0DE5 on Friday June 12, 2015 @01:06PM (#9707167)
Thanks for sharing. Does anyone have an extra copies of the Hack Reactor challenges/lessons? Would love to brush up on my JS skills and I hear they're the best.
Re:Show HN: A Repo of JavaScript Coding Challenges by reqres on Friday June 12, 2015 @05:23PM (#9708637)
Think there's an issue with the throttle challenge

For tests 3 and 4, you expect the context and args to be determined by the last callback. But according to the first 2 tests, the last callbacks should never be invoked.

Looks like someone already raised an issue: https://github.com/kolodny/exercises/issues/3

Re:Show HN: A Repo of JavaScript Coding Challenges by danielvinson on Friday June 12, 2015 @05:36PM (#9708711)
Are these challenges supposed to be solvable within a reasonable amount of time in an interview (15-30 minutes)? Looking through the problems they are all things I could do, but I don't think I would be able to solve any of the harder ones in under an hour - and that would be on my own, not in a high-stress interview.
Re:Show HN: A Repo of JavaScript Coding Challenges by seanp2k2 on Friday June 12, 2015 @10:08PM (#9709593)
Is solving a problem like this in 15-30 minutes under a good deal of stress and likely without reference likely on a whiteboard something someone in the position you're hiring for would ever need to do?
Re:Show HN: A Repo of JavaScript Coding Challenges by clintonc on Friday June 12, 2015 @09:26PM (#9709490)
I really like the approach of cloning the repository and writing to the tests!
Re:Show HN: A Repo of JavaScript Coding Challenges by echeese on Friday June 12, 2015 @12:57PM (#9707092)
In the throttle README, shouldn't throttled() be called instead of sayHi()?
Re:Show HN: A Repo of JavaScript Coding Challenges by kolodny on Friday June 12, 2015 @01:16PM (#9707241)
Yup, fixed. Thanks
Re:Show HN: A Repo of JavaScript Coding Challenges by amelius on Friday June 12, 2015 @05:37PM (#9708718)
Another nice task that fits in here is to convert an integer to a decimal string and back. Obviously without using the native functions that do the same.

Or to make a histogram of the letters that occur in some file.

Re:Show HN: A Repo of JavaScript Coding Challenges by phragg on Friday June 12, 2015 @01:08PM (#9707187)
Why would I edit index.js in vim vs test.js -- possible typo?
Re:Show HN: A Repo of JavaScript Coding Challenges by kolodny on Friday June 12, 2015 @01:16PM (#9707238)
You should be creating the index file, it's the solution to the problem. If you were going to edit the test.js it would make it really simple ;)
Re:Show HN: A Repo of JavaScript Coding Challenges by phragg on Friday June 12, 2015 @01:17PM (#9707244)
ah gotcha :P tbh I'm not quite familiar with writing tests or making solutions to tests, so these exercises will prove to be useful. Thanks!
Re:Show HN: A Repo of JavaScript Coding Challenges by xtrumanx on Friday June 12, 2015 @04:38PM (#9708370)
Pro tip: MDN is your friend while solving these.