My array mapping

My array mapping
0.0 0

#1
 this.era= this.arabic.map((val,i,array)=>{
   
    return    ?????
      
  },this)
  
    console.log(this.era);

hi again im trying to map an array as so but if i just code return i, it just prints all the index to 100.
but if i want an array with index number and comma and next value? how to code it.
i, val i get syntax error and onli print values. any ideas>??


#2

Can you show a short example of the array you want to return?


#3
[…]
​
0: "094.9700"
​
1: "194.9950"
​
2: "294.9800"
​
3: "394.9150"
​
4: "494.9600"
​
5: "594.9300"
​
6: "694.9401"

it just looks like this if i code return i+val
but i want i to be a separate element and val the next after


#4

no expert, but not sure you need the this arg, or the array param. If you want i,val, just build the string and return it:

this.era = this.arabic.map((val, i) => {
  return  i+', '+val;
});

alternatively, use template string return `${i}, ${val}`;


#5

thanks alot helping me with my pain I dont know if i need more options
but is it possible to map also decide like [0] 94 [1] 1 [2] 93.4
etz im happy witth the answer allready but is it possible if i ever need it>?


#6

I would think that is possible. How to go about it? Well you have to edit the string, maybe start by removing the comma.