Member-only story

‘A new array slicing representation in JavaScript — array \[start: top: step\]’

Beck Moulton
4 min readOct 27, 2024

--

Using this new slice representation, we will no longer write the followingslice()code:

But you can write code like this:

This writing style is not only more concise and readable, but also more intuitive.

Even better, we don’t have to wait for its official release — we can use it now. You can expand it byArrayClass to implement this function:

Process unspecified end index

If we omit the second digit (i.eendWill the array be sliced to the last element (parameter)?

It wouldn’t do that?

--

--

Beck Moulton
Beck Moulton

Written by Beck Moulton

Focus on the back-end field, do actual combat technology sharing Buy me a Coffee if You Appreciate My Hard Work https://www.buymeacoffee.com/BeckMoulton

No responses yet