title: Replace months in javascript array
body: <p>in <code>this.sources</code> I have this kind of array data:</p>
  
  <pre><code>this.sources = [
    {
      cost: 50000.5,
      ids: { 1: "11112", 2: "1112", 3: "121212" },
      months: { 1: "54548.5000", 2: "45.0000", 3: "510.5000" },
      name: "test1"
    },
    {
      cost: 12469134.5,
      ids: { 1: "19689", 2: "19690", 3: "19691" },
      months: { 1: "12345678.5000", 2: "0.0000", 3: "50.5000" },
      name: "test2"
    }
  ];
  
  </code></pre>
  
  <p>What I need is to replace all data in months for all cases (just to change the 4 decimals to 2) and then return the array with the same structure as it is.</p>
  
  <p>What I tried:</p>
  
  <pre><code>this.sources = this.fixDecimal(this.sources);
  
  fixDecimal(source) {
    for ( let elx in source ) {
      let newsource = source[elx];
  
        for ( let x = 0; x &lt;= 11; x++ ) {
          let result = newsource.months[x];
  
          if (result) { if (result) { result.map(y =&gt; y.toFixed(2));}
    }
    }
    return result;
  }
  </code></pre>
  
  <p>However this is not working at all. Is there any simple solution just to fix the decimals in months and return the same array with changed data?</p>