Comment by ansgri

11 years ago

Am I right that len(" null") here is 5, so it's working incorreclly?

I think the joke here is that javascript has a long history of thinking that this:

    null

is the same as this:

    "null"

...Which it isn't.

Thought it was a typo on my part... but HN seems to be trimming running spaces.

  • HN isn't: your browser is. Runs of whitespace are collapsed in HTML to single spaces unless specifically styled otherwise. You can verify that they're there by viewing the page source.

    • I like to use non-breaking spaces for that kind of thing, although they still might collapse that? At least it doesn't wrap non-breaking spaces.

      1 reply →