DEV Community

loading...

Discussion on: Is JavaScript's .shift() Method a Performance Boost?

Collapse
aminmansuri profile image
hidden_dude

just change:

let next = (i+1) % a.length

to

let next = (i+offset) % a.length

Where offset is the number of spaces you want to shift.