DEV Community

Discussion on: The beauty of Functional Programming

 
garciat profile image
Gabriel Garcia

Another option is

function what([x, ...xs]) {
  return ['new first elem', ...xs];
}