Ad
  • Custom User Avatar

    I think as far as "best practices" are concerned, it's what the code actually does that matters when voting, not the actual style of code employed when writing the solution.

    I don't think people are marking submissions as "clever" because someone deleted whitespace/newlines and shortened 3 lines of code into 1, they're voting "clever" because what the code is doing is clever - regardless of syntax, style and other cruft. It just so happens that in a lot of cases, particularly these easier problems, "clever" solutions consist of one line. In addition a lot of people seem to be going for code golf, though there's no benefit of doing that.

    In an actual codebase I think that, while most people would spread this snippet of code out, it would nonetheless be considered "best practice".

  • Custom User Avatar
    p1=[1,1];
    p2=[1,1];
    p1 == p2 // false
    
  • Custom User Avatar

    Array(number) will give you an array of number undefined's, so you have to add one since the "hue" is really the glue between them.

  • Custom User Avatar

    Apparently we should not be checking if the property exists?