Iterating over array of strings produces error

前端 未结 4 1291
太阳男子
太阳男子 2021-01-26 13:22

I pass in an array of error messages to parse. An example input would be:

\"An item with this x Id already exists.
 An item with this y id already exists.
 An it         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-26 14:01

    Never loop over an array with for...in.

    Iterates over the enumerable properties of an object, in arbitrary order.

    Why is using "for...in" with array iteration a bad idea?

提交回复
热议问题