JSFiddle - React, Tailwind, and code Playground

by Cl3MM

JavaScript

var errors = [
  { code: 35, name: "Authentication" },
  { code: 34, name: "Validation" }
]

var find = function(code) {
  return errors.filter(function(i) { return i.code === code })
}

document.write('<pre>' + JSON.stringify(find(34), null, 2) +'</pre>')
document.write('<pre>' + JSON.stringify(find(38), null, 2) +'</pre>')