I am passing an object from a function that contains an array arrCombined. I have an object titled results that I would like to map and remove the strings to so I can convert these strings into an integer. When mapping my array of objects for resultsI am stuck on getting undefined.
Here is my array:
[..]
0: Object { result: "494,927", risk: "LOW", sector: "Online" }
1: Object { result: "48,883", risk: "MEDIUM-LOW", sector: "Retail Stores" }
2: Object { result: "59,976", risk: "MEDIUM-LOW", sector: "Store Pick up" }
3: Object { result: "1,205,915", risk: "MEDIUM", sector: "Drive in" }
4: Object { result: "1,434,262", risk: "LOW", sector: "In store" }
I am declaring a variable finalResult to return the targeted "result" in my mapping function which looks like this.
let finalResult = arrCombined.arrCombined.result.map(function (e) {
return Number(e.replace(/(,\s*)+/g, '').trim());
});
console.log(finalResult) // undefined.
I am expecting a finalResult to return the result objects as numbers, i.e. 494927, 48883, 59976, 1205915, 1434262
arrCombined.map(function(e)ande.result.replaceUncaught TypeError: e.replace is not a function