← Back to context Comment by rbobby 11 years ago > basic null checkWhat's funny to me is that leftpad(null, 6, ' ') outputs " null". 6 comments rbobby Reply ansgri 11 years ago Am I right that len(" null") here is 5, so it's working incorreclly? daveloyall 11 years ago 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. rbobby 11 years ago Thought it was a typo on my part... but HN seems to be trimming running spaces. talideon 11 years ago 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. 2 replies →
ansgri 11 years ago Am I right that len(" null") here is 5, so it's working incorreclly? daveloyall 11 years ago 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. rbobby 11 years ago Thought it was a typo on my part... but HN seems to be trimming running spaces. talideon 11 years ago 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. 2 replies →
daveloyall 11 years ago 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.
rbobby 11 years ago Thought it was a typo on my part... but HN seems to be trimming running spaces. talideon 11 years ago 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. 2 replies →
talideon 11 years ago 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. 2 replies →
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:
is the same as this:
...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.
2 replies →