Commit 124b1c99 authored by Sindre Sorhus's avatar Sindre Sorhus

Vanillajs app: Fix bug when removing a single todo item

parent 8d004d8f
...@@ -121,9 +121,9 @@ function editTodo( todoId, text ) { ...@@ -121,9 +121,9 @@ function editTodo( todoId, text ) {
} }
function removeTodoById( id ) { function removeTodoById( id ) {
var i, l; var i = todos.length;
for ( i = 0, l = todos.length; i < l; i++ ) { while ( i-- ) {
if ( todos[ i ].id === id ) { if ( todos[ i ].id === id ) {
todos.splice( i, 1 ); todos.splice( i, 1 );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment