Javascript – Can somebody please explain this react code to me? I can't seem to wrap my head around it
function handleChecking(index) { const updatedTasks = tasks.map((task, i) => i === index ? { ...task, checked: !task.checked } : task ); updatedTasks.push(updatedTasks.splice(index, 1)[0]); > if (!updatedTasks[updatedTasks.length - 1].checked) { > updatedTasks.unshift(updatedTasks.pop()); > } setTasks(updatedTasks); } I need thorough explanation of…