var arr = [];
var data = [
{ name: 'abc1' }, { name: 'abc2' },
{ name: 'abc3' }, { name: 'abc4' },
{ name: 'abc5' }, { name: 'abc6' },
{ name: 'abc7' }, { name: 'abc8' },
{ name: 'abc9' }]
for (var i = 0; i < data.length; i+1) {
let val = data.splice(i, i + 2)
arr.push(val)
}
let arr2 = arr.map(item => {
let obj = {
data: []
}
item.forEach(items => {
obj.data.push(items.name)
})
return obj;
})