I have an JS array with nested objects as a "task list". They each are added with different Urgency properties. Now my function needs to find the highest urgency value - set this to a variable and then remove it from the array.
I am stuck at removing it from the original array. The trouble I have might just be finding the index:
function newTask() {
// reducing the "task list" to just the highest urgency
let maxObj = taskList.reduce((max, obj) => (max.stockUrgency > obj.stockUrgency) ? max : obj);
outputNewtask = JSON.stringify(maxObj, null, 4);
let index = taskList.indexOf("outputNewtask")
console.log(index)