Skip to content
Advertisement

ES6 reduce array without typescript error

i want to remove the first array element, without modified the original (immutable),
something like this:

JavaScript

the code works, but the typescript check complained:

JavaScript

Is there the elegant/better way to do somilar to getAnother()?

Advertisement

Answer

You can ignore an element with a comma.

JavaScript

Array#slice can also be used in this case.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement