Ad
  • Default User Avatar

    Is this more clear?

    
    function largestPairSum(numbers) {
      if (numbers == null || numbers.length < 2) {
        return null; 
      }
      var highest = Number.NEGATIVE_INFINITY;
      var second_highest = Number.NEGATIVE_INFINITY;
      for (var i = 0; i < numbers.length; ++i) {
        if (numbers[i] > highest) { 
          second_highest = highest;
          highest = numbers[i]; 
        }
        else if (numbers[i] > second_highest) { 
          second_highest = numbers[i]; 
        }
      }
      return highest + second_highest;
    }
    
  • Custom User Avatar

    Programming

    Excerpt:

    Somebody wrote a programming language that let somebody else write this:

    #:: ::-| ::-| .-. :||-:: 0-| .-| ::||-| .:|-. :||
    open(Q,$0);while(){if(/^#(.*)$/){for(split('-',$1)){$q=0;for(split){s/|
    /:.:/xg;s/:/../g;$Q=$_?length:$_;$q+=$q?$Q:$Q*20;}print chr($q);}}}print"n";
    #.: ::||-| .||-| :|||-| ::||-| ||-:: :|||-| .:|
    

    According to the author, that program is "two lines of code that parse two lines of embedded comments in the code to read the Mayan numbers representing the individual ASCII characters that make up the magazine title, rendered in 90-degree rotated ASCII art."
    That program won a contest, because of course it did. Do you want to live in a world like this?

  • Custom User Avatar

    Why don't you just add an argument to bob:

    function bob(mob) { ... }

  • Custom User Avatar

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

  • Custom User Avatar

    This is absolut unreadable magic. Rocket science :P