Javascript typeof function