I have a callback function which can be re-usable based on the argument that is passed while calling the function, It will be helpful to decide the behavior of callback function
Callback function:
sampleArray = [5, 3, 4, 6, 7];
getProcessedData = (value, args) => {
console.log('manoj', args);
if(args === 'value a') {
...
} else if (args === 'value b') {
...
}
return;
};
I using array.every() function on the above array
sampleArray.every(getProcessedData, 'value A');
sampleArray.every(getProcessedData, 'value B');
But I'm not able to receive this 'value A' in getProcessedData() function, I have tried with few other way, but it didn`t work. Any suggestion would be helpful