Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Friday, June 1, 2012

Javascript null, undefined, false etc etc

What counts as false

When Javascript is casting to a boolean, eg in an if statement, it treats as false the following values:

null
undefined
""
0 (or any number equivalent to 0 eg -0, 0.0 etc, or a string that represents such a number)
NaN

So !value will be true if value is any of the above.

What can't take a property setting or index

It's an error to try to set or get a property (with .) or an index (with []) on a null or undefined value.

Followers

Blog Archive