138

Javascript in a nutshell

Comments
  • 18
    People never read documentation.

    But null is made into int and becomes 0 because of the >= .
  • 6
    I've yet to see someone ranting about JS for something other than implicit conversions. ☺
  • 0
    @No-one now they know :)
  • 3
    I've got functions inside functions inside functions.

    "[object Object]"
  • 0
    What 'bout (null > 0) && (null == 0) ?
  • 4
    @Sully because == doesn't change types randomly. It tries strings to int and some other types specified in documentation
    For example '0' == 0 true because it will transform the string to number.
    '0' == null is false
    '0' >= null is true because it forces them into int both.

    Null isn't the same as in any language.
  • 0
    Forever and ever....aaaammmeennn
  • 1
    I was this a few months back... Now I want everything in JavaScript! 🙈
  • 0
    Have you tried [] + [] or {} + []
  • 2
  • 0
    think of it like this .... the operator is just a function that returns a boolean value for 2 arguments , true if those arguments are from the same value & type and false if not.
  • 0
    @curlyDev I concur with @Greggergalactic , that made a lot of sense, thanks \m/
  • 2
    I seriously don't know any language which treats null and null-alike types in an intuitive and consistent manner. Ducktyped languages seem intuitive but inconsistent in certain edge cases due to conversions, stricter languages are consistent but have somewhat more difficult structures to deal with it like optional/maybe types.

    I think it's mostly just because nothingness is not a simple thing for humans to think about.

    I really don't mind Javascript being a bit quirky, she's quite easygoing and only shows her crazy side if you push her too far on purpose.
  • 0
    @leozues check this out
Add Comment