title: Update array value inside promise ionic 4
body: <p>I want to get API data and set to localStorage(after convert image from the server to base64). When I get data from API, I create a simple loop for update image URL to base64 format but <code>this.users[key].picture["large"] = dataUrl;</code> don’t work. Because of <code>dataUrl</code> value don’t work outside of a function.
  <strong>How can I update the row object?
  What can I do?</strong></p>
  
  <pre><code>this.http.get&lt;User[]&gt;('https://randomuser.me/api?result=100').subscribe(data =&gt; {
    this.users = data['results'];
  
    for (let key in this.users) {
      let value = this.users[key].picture["large"];
  
      this.toDataURL('//cors-anywhere.herokuapp.com/' + value)
        .then((dataUrl) =&gt; {
          console.log(dataUrl);//correct returned value
          this.users[key].picture["large"] = dataUrl;
        });
          console.log(this.users[key].picture["large"]);//not equal to dataUrl
    }
  
    this.storage.set('users', "");//clear
    this.storage.set('users', this.users);
    console.log(this.users);
  });
  </code></pre>
  
  <p>my toDataUrl function:</p>
  
  <pre><code>public toDataURL(url) {
  return fetch(url)
    .then(response =&gt; response.blob())
    .then(blob =&gt; new Promise((resolve, reject) =&gt; {
      const reader = new FileReader();
      reader.onloadend = () =&gt; resolve(reader.result);
      reader.onerror = reject;
      reader.readAsDataURL(blob);
    }));
  </code></pre>
  
  <p>}</p>