for-in statement

后端 未结 4 1201
花落未央
花落未央 2020-11-30 07:07

TypeScript docs say nothing about loop like for or for-in. From playing with the language it seems that only any or string

4条回答
  •  春和景丽
    2020-11-30 07:48

    The for-in statement is really there to enumerate over object properties, which is how it is implemented in TypeScript. There are some issues with using it on arrays.

    I can't speak on behalf of the TypeScript team, but I believe this is the reason for the implementation in the language.

提交回复
热议问题