I have a Javascript object:
var errorMap = {
100: 'You must enter a name.',
200: 'You must enter an address.',
300: 'You must enter a DOB.'
}
In another part of my code, I am receiving an array of error codes:
var errorCodes = [100, 200, 500, 600];
What I'd like to do is compare the errorCodes
array to the errorMap
object's keys and return all error codes that do not have a corresponding key in errorMap
. In this case, I would like to get this back:
[500, 600]
How do I do this? I have access to jQuery.