It's an error.  The intent is to print "undefined" for undefined values and "null" for null values (for which x.toString won't work).  But it prints "object" for null values.  I'll fix this.