Ad
  • Default User Avatar

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

  • Custom User Avatar

    Fixed. I removed some pointless and broken stuff in Preloaded.

  • Default User Avatar

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

  • Custom User Avatar

    Hey yeah, I should get rid of that test. But I cant think of an idea of how to restrict users from declaring variables outside of the function. Hrm.

  • Custom User Avatar
    "javascript coffeescript vbscript javacode"
    
    /(?!java)\w+script\b/ :
    
    match form string index 1
    (?!java) matched nothing
    \w+ matched "ava"
    script matched "script"
    
    /(?!java)\b\w+script\b/ will be correct
    \b match a character bounder, so it should not matchs from ava...
    
  • Custom User Avatar

    Wow, you are really serious about helping other people. Your explaination should get more voted. Thank you very much, I have learned something new from it. Keep doing the good work, and have a nice day. :)

  • Default User Avatar

    That probably should be 'lowerCase' not 'loverCase'

  • Custom User Avatar

    Hi Matorzinho!

    Sure thing:
    You can think of the comma operator as a way to compose multiple expressions into a single expression chain.

    The expressions are evaluated in order, with each of their results discarded. The final expression however (the last one in the chain) returns its result as the result of the combined expression.

    For Example:

    var doThreeThings = function() {
      one(); // Evaluate expression and disregard its return value
      two(); // Evaluate expression and disregard its return value
      return three(); // Evaluate expression and return its return value
    }
    

    Could be re-written with the comma operator as:

    var doThreeThings = function() {
      // Evaluate one() and disregard its return value
      // Evaluate two() and disregard its return value
      // Evaluate three() and return its return value
      return one(), two(), three();
    }
    

    This can be useful if you need to use multiple expressions in a place that can only take a single expression. However, I haven't seen many uses that wouldn't be improved by being more explicit so I try to reserve its use for code golf.

    Because this function now contains a single statement, it could be further-reduced.

    var doThreeThings = () => (one(), two(), three());
    

    Also worth noting that the comma has the lowest operator precedence, so consider parentheses.

    Hope this helps!

  • Custom User Avatar

    Hi colby,
    I want to know the same thing that Viktor asked but I didn't understand your answer, would you mind rephrasing it?

    I always see your solutions and they are a great motivation for me, thanks!

  • Custom User Avatar

    The comma operator evaluates each of the statements, left to right, regardless of their return, and returns the result of the final statement.