Hi, I need to finish function purser,which will include header
row and i can get same output
/*
[
{ firstName: 'moe', lastName: 'green' },
{ firstName: 'lucy', lastName: 'liu' },
{ firstName: 'ethyl', lastName: 'mertz' }
]*/
In javascript please
const parser=(d)=>{
let arr=[];
let newArr=[];
let obj={}
let items=d.split('|');
for (let i=0;i<items.length;i++){
arr[i]=items[i].split(',');
}
for (let z=0;z<arr.length;z++){
newArr=newArr.concat(arr[z]);
}
for(var y = 0;y < newArr.length;y+=2){
obj[newArr[y]]= newArr[y+1];
}
//const res = newArr.reduce((a,b)=> (a[b]='',a),{});
return obj;
}
const data...