{"ScriptPreparationCode":null,"TestCases":[{"Name":"slice \u0026 spread","Code":"function removeTodo(id, list) {\r\n const indexToRemove = list.findIndex((item) =\u003E item.id === id);\r\n return [...list.slice(0, indexToRemove), ...list.slice(indexToRemove \u002B 1)];\r\n}\r\nconst id = 5;\r\nconst list = [{id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 5, done: false}]\r\nconst other = removeTodo(id, list)","IsDeferred":false},{"Name":"reduce","Code":"function removeTodo(id, list) {\r\n return [...list].reduce(\r\n (acc, item) =\u003E (item.id === id ? acc : [...acc, item]),\r\n []\r\n );\r\n}\r\nconst id = 5;\r\nconst list = [{id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 1, done: false}, {id: 5, done: false}]\r\nconst other = removeTodo(id, list)","IsDeferred":false}]}