Ad
  • Default User Avatar

    The queue part was extremely confusing. The console didn't said much really and was hard to see what was the problem. It become confusing because you didn't say how you were gonna use it. I think more guidance should be puten into this, otherwise it could be a great topic.
    Quite frankly I'm not sure about this pattern. This pattern is fine if you use it with coroutines to yield until the method is finished.

  • Default User Avatar

    I've made the StatePattern one and I found it to be really similar to this one. It's not very clear what the difference would be between the two, except than in one you use the variables and here you use the methods. Also found funny that the variables are all writen in caps. Interesting series though.

  • Default User Avatar

    I notice how the test changed the state, cause I was wondering about it, and noticed that each time you want to switch you create an object.
    Soesn't it create a hell lot of garbage collection if your constantly creating and destroying objects?
    Whenever I use the "new" keyboard I wonder this. Would it be preferable if you'd create the two states in the tank class and re use them?

  • Default User Avatar

    I really like codeWars. I think a more traditional kind of forum would be a useful addition. A place where people can make new threads with more categories, where you could ask questions to the community or discuss how to improve or learn something, etc. People usually learn by talking to other people with same tasks. I have often found myself missing a regular forum here...

  • Default User Avatar

    haha... glad to see everyone got big long messy solutions in JS with 4loops and all (and not only me). As a feedback all I can say is that I got stuck with the first newline for quite some time not knowing what was wrong, is not a critique though. It looked like the answer matched mine exactly. It made me realize that I have no idea on how to debug invisible string characters... so if anyone know a built in way, please share the tip!

  • Default User Avatar
  • Default User Avatar
  • Default User Avatar

    thanks, that makes sense.

  • Default User Avatar

    in the javascript version:
    Test.assertEquals("$9.692".toCents(), null);
    Why would this one return null? I fail to understand.

  • Default User Avatar

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

  • Default User Avatar

    I think both links at the end go to the same page.
    Trying to use the Set () function I get an "e is undefinded error".
    The spread operator seems pretty cool, still don´t fully get why you use it here, it looks like the new Set function just gave the result you wanted, so why are you passing the elements? Is it to store the results of a set into an array (because you need the result to be in an array instead of a set)? don´t worry I´ll figure it out, you helped me a lot!
    Thanks a lot for the very complete reply, i´ll study it.

  • Default User Avatar

    This is my solution, but the machine is not accepting it... even though i´ve check it in other places with good results. Along with the "unknown" errors and times out, it sometimes says my result is NaN. I´ve tasted in other places and the result seems matching the ones in the test cases, and ther result is indeed a number. Maybe there´s some difference between the JS i´m using for testing and this one, if you find the mistake please to tell me.

    function orangeFraction(fractions){
    var arr = parseFloat (fractions.match(/\d{1,}/g)); var result = 0;
    for (var i = 0; i < arr.length; i++) {result += arr[i];}
    return (result/arr.length).toFixed(4);}

  • Default User Avatar

    i´m a beginner, could someone explain this solution?

  • Default User Avatar

    Thanks, for some reason the first time I submitted the code, there wasn´t any reference of what test I had failed at.

  • Default User Avatar

    in one random test, I got an array with BOTH a NaN and an undefinded value. Since the NaN was before the undefined value in the array, my function returned NaN as soon as it reached that value... but the test expected "false" instead.
    All and all is quite confusing since NaN was -like many have noticed- not even mentioned in the instructions, but I think I got the worst part of it, because it really just didn´t make any sense the part where I had to guess what should it return in a case where there were both a NaN value and one that was undefined in the same array.
    Since it was a random test, and I had enough, I just refreshed the page and submitted again, wich did the trick.

  • Loading more items...