Learn localStorage by Building a Todo App - Step 48

Tell us what’s happening:

Sorry, your code does not pass. Keep trying.

Your localStorage.setItem() should have a key of "data".

Your code so far




The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

Learn localStorage by Building a Todo App - Step 48

To solve this problem you need to use the localStorage, and understand how it works. Reviewing your code, it looks like you’re misunderstanding the use case of setItem.

The setItem function takes 2 arguments:

  1. The key: should be a string
  2. The data

It just likes the JSON structure.

The problem required you to store the data of the todo myTaskArr as the key of data, which mean that the first and the second argument of the setItem is in this order: "data" as string, myTaskArr as JS array.

Hope it helps.

1 Like