What I have the ability to do:
const resultValue = array.find((resultValue) => <certain condition>);
const resultIndex = array.indexOf(resultValue);
What I am interested in doing:
const { value, position } = array.someFunction((value, position) => <certain condition> && { value, position });
Is there anything similar available? some()
only returns a boolean, and find()
simply retrieves the array element, neither of which is suitable for this specific scenario.