I want output like this:
items = [['red', 'blue', 'green'], ['small', 'medium', 'large']]
I have array item which has value:
items = ['red', 'blue', 'green','small', 'medium', 'large']
if mutation is not a problem, then you might remove initial array until you move them 3 by 3 into new one.
const items = ['red', 'blue', 'green', 'small', 'medium', 'large'];
let itemList = [];
while (items.length > 0) {
itemList.push(items.splice(0, 3))
}