typeof typo and missing var keyword