Announcement

Collapse
No announcement yet.

reduce function für Internet Explorer umwandeln

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • reduce function für Internet Explorer umwandeln

    Hallo zusammen,

    ich habe folgende Funktion:

    var arr = [{"type":"1"},{"type":"2"},{"type":"3"},{"type":"4" },{"type":"5"},{"type":"6"},{"type":"7"},{"type":" 8"},{"type":"9"},{"type":"10"}];
    const output = arr.reduce((acc, name, id) => (acc[`techName${id}`] = [name], acc), {});


    Wenn ich es für den Internet Explorer umwandel (IE kennt leider keine arrow function), kommt ein anderes Ergebnis raus.

    var arrIE = [{"type":"1"},{"type":"2"},{"type":"3"},{"type":"4" },{"type":"5"},{"type":"6"},{"type":"7"},{"type":" 8"},{"type":"9"},{"type":"10"}];
    var jsonOutput = arrIE.reduce(function(acc,name,id) {
    acc[`techName` + id] = name;
    return acc;
    } );


    Wer kann mir helfen?
    Attached Files

  • #2
    https://stackoverflow.com/questions/...o-work-with-ie
    Christian

    Comment

    Working...
    X