19

What the!
I knew Javascript is messed up as hell but this...

I wondered an hour why "MyObject.size" is zero every time until I finally reallised that I only forgot the brackets.
Why, why does this return zero instead of throwing an exception, or at least "Function" or something like that?

That's bullshit! Arrrrgh...

Comments
  • 13
    Good guy JavaScript just wants to work. It is the developer who is terrible. 😋
  • 4
    So your saying it's Javascript fault when it doesn't execute a function, if your not executing it?

    Get your toolset right, and don't blame the language for allowing flexible things.
  • 1
    Read an object what doesn't exist? This would have the value undefined.

    Or what are you talking about?
  • 2
    @plusgut In which case would a result of zero be helpful?
  • 1
    Zero? That is not the case.
  • 2
    It is.
  • 0
    @Benedikt I was talking to @Jop- an not existing property has the value undefined, that is not the same as zero.

    Show me the codesnippet what you are talking about.
  • 0
    Are you using "use strict"?
  • 2
    (a good linter would catch this....)
    (Also, typescript if you really want)
Your Job Suck?
Get a Better Job
Add Comment