Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
152
rated 0 times [  156] [ 4]  / answers: 1 / hits: 36236  / 8 Years ago, tue, july 5, 2016, 12:00:00

I have to arrays (Name and State Array) and map them togther into one object with the attrbiutes name and state.



Array Name:



 [Time, Riskchanged, Scope, Risk4, Test, Test(2)]


Array State:



 [In Bearbeitung, Abgeschlossen, In Bearbeitung, Abgeschlossen, Geplant, In Bearbeitung]


Function:



this.testArr = this.riskNamesArr.map( (x, i) => {
return {name: x, state: this.riskWorkflowStateArr[i]}
});


This works perfect on all Desktop Browsers but unfortunately not on my iOS Safari Browser.. The mobile Browser just shows nothing if I add those lines..



So is there another approach to get the same result?


More From » arrays

 Answers
22

I think thats a problem with the arrow-function - thats ES6-style. Try using a simple function:



testArr = riskNamesArr.map( function(x, i){
return {name: x, state: riskWorkflowStateArr[i]}
}.bind(this));


JSFiddle: https://jsfiddle.net/urbr49d3/


[#61506] Sunday, July 3, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
donovantyriqn

Total Points: 271
Total Questions: 98
Total Answers: 113

Location: Saint Vincent and the Grenadines
Member since Sat, Sep 11, 2021
3 Years ago
;