I have string like
var sHTMLTable = "> 24 Hrs.,2,19,20,10,27,16,26,64,246,1|> 12 Hrs.,0,0,0,0,0,0,0,0,0,0|> 8 Hrs.,0,0,0,0,0,0,0,0,0,0|> 4 Hrs.,0,0,0,0,0,0,0,0,0,0|Total,2,19,20,10,27,16,26,64,246,1"
I want it to convert to Sub Array
var res = sHTMLTable.split("|").map(function (s) {
var arr = s.split(",");
return { name: arr.shift(), data: arr.map(Number) };
});
console.log(JSON.stringify(res));
Which give me perfect output
[{"name":"> 24 Hrs.","data":[2,19,20,10,27,16,26,64,246,1]},{"name":"> 12 Hrs.","data":[0,0,0,0,0,0,0,0,0,0]},{"name":"> 8 Hrs.","data":[0,0,0,0,0,0,0,0,0,0]},{"name":"> 4 Hrs.","data":[0,0,0,0,0,0,0,0,0,0]},{"name":"Total","data":[2,19,20,10,27,16,26,64,246,1]}]
But it throws error in IE because of .map
function i used . how can i make it work in IE by achieving same result ?