Javascript - how to start forEach loop at some index

前端 未结 6 1636
予麋鹿
予麋鹿 2021-01-04 00:31

I have an array with alot of items, and I am creating a list of them. I was thinking of paginating the list. I wonder how can I start a forEach or for

6条回答
  •  南笙
    南笙 (楼主)
    2021-01-04 01:17

    array.values() to get the iterator, .next() it and use it.

    let ar=[1,2,3,4]
    
    var _;for(let a of(_=ar.values(),_.next(),_)){
      console.log(a)
    }

提交回复
热议问题