i got data like this
const data = [
{
name: "Joe",
age: 23,
job: "Artist",
hoby: "Drawing",
},
{
name: "Michael",
age: 21,
job: "Engineer",
hoby: "Fishing",
},
{
name: "Jenifer",
age: 22,
job: "Dentist",
hoby: "Gardening",
},
]
and wanna got output like :
{ header: [ 'number', 'name', 'age', 'job', 'hoby' ],
data:
[ { name: 'Joe', age: 23, job: 'Artist', hoby: 'Drawing' },
{ name: 'Michael', age: 21, job: 'Engineer', hoby: 'Fishing' },
{ name: 'Jenifer', age: 22, job: 'Dentist', hoby: 'Gardening' }
] }
requirement: use pop, push, shift and unshift
my code for now is :
data.unshift(header);
data.pop(data)
data.pop(data)
data.pop(data)
data.push(data1);
but i got wrong answer wkwkw