title: Sorting an array of objects (Outputting data but not in order)
body: <p>This is a shortened version of some data that is returned:</p>
  
  <pre><code>var array = 
  [{
      "response":
          {
              "itineraries":[
              {
                  "price":
                  {
                      "totalPricePerPassenger":"104"
                  }
              },
              {
                  "price":
                  {
                      "totalPricePerPassenger":"102"
                  }
              },
              {
                  "price":
                  {
                      "totalPricePerPassenger":"103"
                  }
              }
              ]
          }
  }];
  </code></pre>
  
  <p>My plan is to sort the data that is returned by the total price.</p>
  
  <p>Here is the code that I am using to sort and display the result:</p>
  
  <pre><code>function sort(a, b){
      var a_price = a.response.itineraries.price.totalPricePerPassenger();
      var b_price = b.response.itineraries.price.totalPricePerPassenger(); 
      return ((a_price &lt; b_price) ? -1 : ((a_price &gt; b_price) ? 1 : 0));
  }
  
  var data = array.sort(sort); 
  console.log(data);
  </code></pre>
  
  <p>From the console.log above this is the result that it outputs, as you can see the prices are still in their original order and have no changed.</p>
  
  <p><img src="https://i.stack.imgur.com/o44Su.png" alt="Console.log output"></p>
  
  <p>Any ideas as to why this might be happening? Am I on the right track?</p>