I have a javascript object which contains error messages:
err: {
subject: '',
body: '',
recipient: ''
},
i want to disable a submit button based on whether an error is present. in the above declaration, there are no errors present.
i'm aware of Object.values(err) but i do not know how to use the resulting list, which has a length of 3.
how would I do this? thank you
Object.values(err).some(e => e !== '' && e !== null && e !== undefined);or something like that. if Object.values is not support, just revert to object.keys:Object.keys(err).some(e => err[e] !== null && err[e] !== undefined && err[e] !== '');(assuming the error is present whenever any key is defined and not empty).