Define an array of errors in JavaScript based on a specification.