0: {color: '', size: 'error_check'}
1: {color: '', size: ''}
2: {color: '', size: ''}
in array query not working this my code
if(jQuery.inArray('error_check', error)) {
console.log("is in array");
} else {
console.log("is NOT in array");
}
CodePudding user response:
I think you want this :
const arr = [ {color: '', size: 'error_check'}, {color: '', size: ''}, {color: '', size: ''}]
if (arr.some(e => e.size === 'error_check')) {
console.log("is in array");
} else {
console.log("is NOT in array");
}
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>