You can use Object.keys()
and .reduce()
method:
let data = {'Achievement': ["110", "100", "104", "110"],'Emp Code' : ["1000001", "1000001", "1000001", "1000001"],'Product' :["Product A ", "Product B", "Product A ", "Product B"],'Reportee Name' :["Harry", "Harry", "Peter", "Peter"],'Target' : ["116", "94", "105", "114"],'percentage': ["94.82758621", "106.3829787", "99.04761905", "96.49122807"]};
let result = Object.keys(data)
.reduce((a, c, i) => (a[i] = [c, ...data[c]], a), {});
console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }
2
solved Making new array and push there keys on that new array [closed]