DEV Community

Discussion on: The beauty of Functional Programming

 
fannyvieira profile image
Fanny

Good suggestion,thanks

Thread Thread
 
garciat profile image
Gabriel Garcia

Another option is

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