Is there any way to add to or manipulate expressions in a returned function?
This is an example for a single argument:
function trackByProp(prop) {
return function (value) {
return value[prop];
};
}
The aim is to extend this function to allow multiple props to be added e.g.
function trackByProp(...props) {
props.forEach((prop) => {
//Somehow add value[prop] to the return function???
});
return function (value) {
return; // value[arg1] + value[arg2] + value[argN]
};
}
Alternatively is there a simpler way to create this function ?