In Javascript I have an array of objects:
var errors = [
{ code: 35, name: "Authentication" },
{ code: 34, name: "Validation" }
]
What is the best option for a reusable function that checks if and array of this type has an item with code == XYZ? If it has then return an array with all those items.