function findFriend(newFriend){
  var fl = friendData.length;  
  //var nObj = newFriend.scores;
  var bFriend = [];
  var lowestScore = 1500;
  console.log(newFriend);
  for (var i = 0; i < fl; i++){
      let candidate = friendData[i].scores;
      let score = compareObjects(candidate, newFriend.scores) 
      console.log("Comparing : " + newFriend.name + " against " + friendData[i].name);
      if (score < lowestScore){
          lowestScore = score;
          bFriend = friendData[i];
          console.log("switching to friend " + bFriend.name);
      } 
  } 
  return bFriend;
}
// loop through friends to find best choice.
loop through friends to find best choice.
loop through friends to find best choice .
function findFriend(newFriend){
  var fl = friendData.length;  
  var bFriend = [];
  var lowestScore = 1500;
  console.log(newFriend);
  for (var i = 0; i < fl; i++){
      let candidate = friendData[i].scores;
      let score = compareObjects(candidate, newFriend.scores) 
      console.log("Comparing : " + newFriend.name + " against " + friendData[i].name);
      if (score < lowestScore){
          lowestScore = score;
          bFriend = friendData[i];
          console.log("switching to friend " + bFriend.name);
      } 
  } 
  return bFriend;
}
function findFriend ( newFriend ) { var fl = friendData . length ; var bFriend = [ ] ; var lowestScore = 1500 ; console . log ( newFriend ) ; for ( var i = 0 ; i < fl ; i ++ ) { let candidate = friendData [ i ] . scores ; let score = compareObjects ( candidate , newFriend . scores ) console . log ( "Comparing : " + newFriend . name + " against " + friendData [ i ] . name ) ; if ( score < lowestScore ) { lowestScore = score ; bFriend = friendData [ i ] ; console . log ( "switching to friend " + bFriend . name ) ; } } return bFriend ; }
loop through friends to find best choice.
loop through friends to find best choice .
//var nObj = newFriend.scores;