12
Comments
  • 2
    Sad because you compare boolean to true
  • 1
    @devitalizer actually I find it more disturbing that if sad evaluates to true, the first line in the function should fail...
  • 0
    @Seethe wow, how could I miss that!
    You a smart one :D
  • 0
    @Seethe but that line might actually work in case sad is an instance of class that extends Boolean class (if there is one in js), but anyway, comparing it's address to true is dumb
  • 1
    @devitalizer there isn't an object in JavaScript that works that way. The result of sad() could be exactly equal to true, or sad() could return a truthy statement, in which case the condition would fail. The problem is evaluating sad() cannot both be exactly equal to true, and an object. This could however be written:

    if(sad() === true) {
    sad.stop();
    beAwesome();
    }
  • 1
    Although that is of course assuming that the language is JavaScript and not one of MANY languages that use dot resolution syntax.
Add Comment