To cast an array in JavaScript, you can use Array.from()
method. This method creates a new array instance from an array-like or iterable object.
index.tsx123 chars5 lines
You can also pass a map function as the second argument to perform an operation on each element when casting the array:
index.tsx132 chars5 lines
Alternatively, you can also use the spread operator ...
to cast an array:
index.tsx116 chars5 lines
gistlibby LogSnag