Checking whether something is iterable

后端 未结 8 947
甜味超标
甜味超标 2020-11-28 04:55

In the MDN docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

The for...of construct is described to be able to

8条回答
  •  悲哀的现实
    2020-11-28 05:01

    Why so verbose?

    const isIterable = object =>
      object != null && typeof object[Symbol.iterator] === 'function'
    

提交回复
热议问题