I have an array
errorPriority: string[] = ['shippingError', 'paymentInfoError', 'generalError'];
I need a function call to be looped on every element of array, but somehow after executing function for first element 'shippingError', the loop stops. Below is the function call
this.errorPriority.every(this.getErrorData);
And the function that is executed
getErrorData = (value: string): void => {
if (eval(this.objectPath[value as keyof ObjectPath]) && eval(this.objectPath[value as keyof ObjectPath]).length)
this.checkoutState.errors[value] = eval(this.objectPath[value as keyof ObjectPath]);
}
It sometimes, works on array element, but mostly stops after first element, Am I missing something, please help
I expect function should be looped on every array element