Top Todo explainer

#1

Aim of the puzzle: Use the shift array method to remove the 1st item in an array.
Walk through of solution: The shift array method is just like .pop(), except it removes the 1st element in an array, rather than the last.

In this puzzle, the todoList array contains 3 strings, 'Do dishes', 'Pay bills', and 'Write novel'.
When the puzzle loads, the topTodo variable has the value todoList[0].

While this will read the first item in todoList, it doesn’t actually remove it from the todoList array. To remove it and complete the puzzle, replace the [0] with .shift().

Sample code solution:

let todoList = ['Do dishes', 'Pay bills', 'Write novel'];
let topTodo = todoList.shift();
console.log('The 1st item on the to-do list is: ' + topTodo);
console.log('The remaining items are: ' + todoList);

Javascript Concepts: Arrays, Array Indexing, Array Methods, .shift(), console.log

#2

:+1:

Had good time learning

Sink is working as expected

The level is updated fine :slight_smile:

#3

That is good to hear!

1 Like