title: Getting the highest value of an JSON array and storing it in Data Vue
body: <p>In my vue component i have a json array of Bids.</p>
  
  <p><a href="https://i.stack.imgur.com/uHPH1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uHPH1.png" alt="enter image description here"></a></p>
  
  <p>I need to get the highest bid from the array and store it into another variable.</p>
  
  <p>My vue component data:</p>
  
  <pre><code>data() {
    return {
      bids: [],
      bid: null,
  
      veiling_id: this.id,
      showInput: this.auth_check,
  
       highestBid: null,
    }
  },
  </code></pre>
  
  <p>Getting the bids from DB and storing into bids.</p>
  
  <pre><code>mounted(){
      var veilingid = this.veiling_id;
      var vm = this;
      setInterval(function(){
          axios.get('/veilingen/' + veilingid + '/getbid').
          then(function (response){
              vm.bids = response.data;
          }).catch(function(error) {
              console.log(error);
          });
       }, 1000);
  
   }
  </code></pre>
  
  <p>And now how do i loop through Bids, get the highest bid and store it into highestBid?</p>
  
  <p>Also what's the best place to store the code?</p>
  
  <p>Right after the AXIOS get request in the mounted() or somewhere else?</p>
  
  <p>I'm sorry i'n new to Vue.</p>
  
  <p>Any help is appreciated..</p>
  
  <p>Requested JSON:</p>
  
  <pre><code>"[{"id":1,"veiling_id":1,"bid":"100.00","user_id":2,"created_at":"2017-08-31 20:24:20","updated_at":"2017-08-31 20:24:20"},{"id":2,"veiling_id":1,"bid":"40.00","user_id":2,"created_at":"2017-08-31 20:43:11","updated_at":"2017-08-31 20:43:11"},{"id":3,"veiling_id":1,"bid":"3.00","user_id":2,"created_at":"2017-08-31 20:43:34","updated_at":"2017-08-31 20:43:34"},{"id":4,"veiling_id":1,"bid":"4.34","user_id":2,"created_at":"2017-08-31 20:44:32","updated_at":"2017-08-31 20:44:32"},{"id":5,"veiling_id":1,"bid":"900.00","user_id":2,"created_at":"2017-08-31 20:44:49","updated_at":"2017-08-31 20:44:49"},{"id":6,"veiling_id":1,"bid":"90.00","user_id":2,"created_at":"2017-08-31 20:51:55","updated_at":"2017-08-31 20:51:55"},{"id":7,"veiling_id":1,"bid":"90.00","user_id":2,"created_at":"2017-08-31 20:53:10","updated_at":"2017-08-31 20:53:10"},{"id":8,"veiling_id":1,"bid":"3.00","user_id":2,"created_at":"2017-08-31 20:53:18","updated_at":"2017-08-31 20:53:18"},{"id":9,"veiling_id":1,"bid":"3.00","user_id":2,"created_at":"2017-08-31 20:53:59","updated_at":"2017-08-31 20:53:59"},{"id":10,"veiling_id":1,"bid":"50.00","user_id":2,"created_at":"2017-08-31 21:03:17","updated_at":"2017-08-31 21:03:17"},{"id":11,"veiling_id":1,"bid":"1000.00","user_id":2,"created_at":"2017-08-31 21:05:35","updated_at":"2017-08-31 21:05:35"},{"id":12,"veiling_id":1,"bid":"2000.00","user_id":2,"created_at":"2017-09-01 00:07:19","updated_at":"2017-09-01 00:07:19"},{"id":13,"veiling_id":1,"bid":"3.00","user_id":1,"created_at":"2017-09-01 00:28:56","updated_at":"2017-09-01 00:28:56"}]"
  </code></pre>