Typo in Step 57 of "Learn localStorage by Building a Todo App"

Step 57 says:

The item you retrieve is a string, as you saved it with JSON.stringify(). To view it in its original form before saving, you need to use JSON.parse().

Use getItem() to retrieve the myTaskArr array again. This time, wrap it inside JSON.parse(), assign it to the variable getTaskArrObj and log the getTaskArrObj to the console.

Check the console to see the difference between getTaskArr and getTaskObj.

However, getTaskObj is not defined during this course (not so far, at least), and Iā€™ve successfully completed the step by checking getTaskArrObj in the console, which is the variable that I was required to define in this step.

Can you provide a direct link to the challenge so I can look at it more closely?

It wants you to declare and assign it.

The ā€œassign it to the variable getTaskArrObjā€ part could be misinterpreted as the variable already existing and only asking for an assignment.

Maybe just changing it to ā€œa variableā€ instead of ā€œthe variableā€ would be enough?


Use getItem() to retrieve the myTaskArr array again. This time, wrap it inside JSON.parse() , assign it to the variable getTaskArrObj and log the getTaskArrObj to the console.

Could be updated to:

Use getItem() to retrieve the myTaskArr array again. This time, wrap it inside JSON.parse() , assign it to a variable getTaskArrObj and log the getTaskArrObj to the console.

Or we could be more explicit about it

Use getItem() to retrieve the myTaskArr array again. This time, wrap it inside JSON.parse(). Declare a getTaskArrObj variable and assign it to that variable, then log the getTaskArrObj to the console.

1 Like

Here you go.

Iā€™m not sure what youā€™re talking about here, and there might be a misunderstanding. The typo is at the bottom of the step, ā€œCheck the console to see the difference between getTaskArr and getTaskObj.ā€

getTaskObj should be getTaskArrObj, because that is the variable that this step instructs you to declare. I was not told to declare a getTaskObj variable. That is the typo.

Edit: Also, I am new to coding, so maybe Iā€™m using the wrong terminology. I do seem to use the words ā€œdefineā€ and ā€œdeclareā€ interchangeably. Maybe thatā€™s where I confused you? Iā€™m not sure if those words all mean the same.

Sorry, I didnā€™t even see that. It does look like a typo.
There is a PR for it.


As an aside, the terrible variable names are not helping here.

Yeah. I think those names are potentially pretty confusing and typo prone. At some point I would love to change them.

As soon as I have a good name for them. XD

Like the first idea I had for alternate names was calling them storedTaskData and storedTaskObj

I would prefer just tasks or todos. Same for the storage key, not sure why it is called data and not what the data is, data seems a little too generic.

Since this step is just showing the difference between the raw and parsed storage, we could just add ā€œparsedā€ to the variable name.

const tasks = localStorage.getItem("tasks")
console.log(tasks)

const tasksParsed = JSON.parse(localStorage.getItem("tasks"))
console.log(tasksParsed)

Ah, ok! I didnā€™t realize someone already brought it up. Thank you!

XD Iā€™ll let you all figure out the variable name changes. See ya!