javascript enhance typeof