• Custom User Avatar

    Got that covered...

  • Custom User Avatar

    Looks like he needs some randomized test cases...

  • Custom User Avatar

    Great observation! Do you accept cookies? I just tried to see if I could come up with something annoyingly clever, guess it wasn't good enough.

  • Custom User Avatar

    LOL. This guy/gal is writing tests on daily basis.

  • Custom User Avatar

    Try using console.log(arr) to see what is getting inserted into each test. The results might be surprising. ;-)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This may be a cookie issue. We know this resolved the issue for others before.

  • Custom User Avatar

    The best javascript book I've read is Javascript: The Good Parts (Edit: and fyi that guy is very strict with his own version of best practices). However, you want to have some programming background before you go about reading it. There are other languages you can try out here, and knowing more than one language definitely helps with dealing with nuances in any language.

  • Custom User Avatar

    Awesome! Thanks very much, it really helped. I just picked up a copy of Eloquent Javascript, which I believe covers some of this.

    Cheers,

  • Custom User Avatar

    jhoffner, not all javascript flavors enforce a specific key order.

  • Custom User Avatar

    I'm still hoping for language-based completion to be implemented, but there are a lot of other things that need to be done, too. Currently I have solved all approved kata, so I encounter this almost 100% of the time.

  • Custom User Avatar

    I've had issues where my solution wasn't invalidated even though it didn't pass the test cases anymore (String.prototype.clone, evil = eval solution). I've also seen some kata with performance requirements where solutions before the performance requirement were still listed.

  • Custom User Avatar

    When I see that, it's when I test a solution rather than submit it, and there's nothing in the example test fixture that uses anything Test.*.

  • Custom User Avatar

    Objects {}, Arrays [], Functions function () {} and RegExps // are all literals that are compared by reference. Basically, if you're saying one array or object is equal to another, they need to be the same reference (i.e. two different arrays are treated like identical twins with different identities, even though they look the same). There are a few other funky things about that regarding methods like slice and sort where the return value still references the pre-existing array in some manner. Definitely something to read up on.

    One problem with your solution is that you're using a for-in style loop. That style loop goes over all properties of an object (for an array it includes length). It's best practice to avoid that unless you're dealing with an object literal (and even then there are further best practices).

    Another thing to watch out for is modifying the original array; again, it's best practice. You should test to ensure that the original array is not the same as the one returned from the function (you can do that with Test.assertEquals).

    Finally, the correct function to use here would be Test.assertSimilar.

  • Custom User Avatar

    I've gotten some feedback on one of my beta kata to include an example test fixture. I updated my kata to provide one, but it isn't showing up in the solver for me (even after refresh).

  • Loading more items...