Q:

Check mutiple values in Array and append third value in html

I want to check if mutiple vlaues exists in the array, and if they do, append the value of a third one- the script below obvously doesnt work, but might give a good idea on what I want to do. i only want to add this once, even if the array checks several times. 
What's the best way to do this? 

var names = {
  list: [{
      "model": "round",
      "type": "Special",
      "typedescription": "appendedvalue"
    }, {
      "model": "round",
      "type": "Special",
      "typedescription": "appendedvalue",
    }
    "model": "round",
    "type": "Special",
    "typedescription": "appendedvalue"
  },
  {
    "model": "square",
    "type": "Special",
    "typedescription": "appendedvalue"
  }]

};

if ($.inArray('model.round', 'type.special'
    names) !== -1) {
  $('.test').append('<p>' + typedescription.appendedvalue + '</p>');
}
<div class="test"></div>

A:

You can use .find to try to find a matching object. Put the test (of whether the object has the model and type you want) in the callback. If it exists, append the property:

var names = {
  list: [{
      "model": "round",
      "type": "Special",
      "typedescription": "appendedvalue"
    }, {
      "model": "round",
      "type": "Special",
      "typedescription": "appendedvalue",
    }, {
    "model": "round",
    "type": "Special",
    "typedescription": "appendedvalue"
  },
  {
    "model": "square",
    "type": "Special",
    "typedescription": "appendedvalue"
  }]

};

const item = names.list.find(({ model, type }) => model === 'round' && type === 'Special');
if (item) {
  $('.test').append('<p>' + item.typedescription + '</p>');
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="test"></div>

