prefer typeof, more robust for null/undefined values