Ad
  • Custom User Avatar

    Amark, please, could you advise me what should I put to the board?
    I have written the solution, but my algorithm does not work because I expected that board will be as [start, diskQuant] :(

  • Default User Avatar

    Should the object constructors return values?

  • Custom User Avatar

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

  • Custom User Avatar

    Well one could write for example a power function with an input for the power of 2 for square and 3 for cube.
    Same with modulo and even/odd.
    Therefore I am okay with similar functions.

  • Custom User Avatar

    I looked at this kata and was turned off by the syntax of 'some string'.toAscii85()

    Modifying the built-in String prototype just isn't something I approve of. Multiple libraries modifying built-in prototypes can cause all kinds of pain. A much better solution would be to make a function that takes a text string as an argument and outputs Ascii85.

  • Custom User Avatar

    I don't mind having to essentially re-type the similar functions. For me it just helps re-enforce the concept and help commit important methods (and how to use them) to memory.

  • Default User Avatar

    I also found it a little bit boring to have to do so many similar functions. Would have been better to skip for example the square() and the even() methods.

  • Custom User Avatar

    Agree with this point. Data as the first input and then sortBy as the second.

  • Custom User Avatar

    I also handled the three character hex descriptors, should be more explicit in the description ;)

  • Custom User Avatar

    I see what you mean. You're right. If Function.prototype.toString is overriden, then my trick to detect a literal regexp doesn't work (which means the regexp check can be bypassed).
    I was hoping for a minimum of fair play, but I'll update the kata the prevent such bypass: Object.freeze(Function.prototype);

    Hmm this makes me think that maybe another bypass is possible by using eval. However that would be crazy shit. I'm not gonna dig too much on that for now.

  • Default User Avatar

    Did you make sure to freeze the Function.toString method for your /^[^]*$/ trick?

  • Default User Avatar

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

  • Custom User Avatar

    Okay, fixed. (I'm more of a python person.)

  • Custom User Avatar

    Looks like there was errors on the site in general at the time. How are things working for you now, Delfuego?

  • Custom User Avatar

    Thank for the feedback guys.
    I've updated the solution to check for both literal and object notation of RegExp.
    -> JulianNicholls & OverZalous solutions not longer pass the tests.

    Object notation was easy to forbid since RegExp is overridable.
    For the /regex/ syntax, I'm using a trick which hopefully we'll not block legitimate code.
    Let me know if you think that's the case.

    I was more worried about the possibility to do something like that :

    var text = "",
        chunk = "@";
    while(chunk.length > 0)
    {
        chunk = this.reader.getChunk();
        text += chunk;
    }
    var splits = text.split(' ');
    
    var words = splits.length,
        chars = text.length,
        lines = text.split('\n').length;
    

    I've explicitly forbid to concatenete calls to getChunk in the test description, but it is technically possible...

    It is possible to pass the test without .split(), but that's ugely restrive.
    Let me know if you see a proper way to do this...

  • Loading more items...