DEV Community

Discussion on: How to shift array position in vanilla JavaScript

Collapse
 
thomasjunkos profile image
Thomas Junkツ • Edited

I would go for

const lastToFirst = (arr) => [arr.pop(), ...arr]

or

ltf= function(arr){ return [arr.pop()].concat(arr) }
Collapse
 
thejoezack profile image
Joe Zack

ES6 FTW!