I have an array of objects like this:
const books =[
{id: "1", name: "twilight", category: "Movies", price: 10},
{id: "2", name: "jaws", category: "Movies", price: 22},
{id: "3", name: "the shining", category: "Movies", price: 1},
{id: "4", name: "beers", category: "Movies", price: 10},
{id: "5", name: "apples", category: "Movies", price: 22},
{id: "6", name: "mono", category: "Movies", price: 1}
]
Trying to slice the first 2, then second 2 etc.
How can I slice by 2 books at the time?
books.slice(0, 2)? that would get you the first 2, then you would just have to keep increasing the indexes to get the remaining parts