Learn localStorage by Building a Todo App step 12

Hi everyone!

Step 12
Next, retrieve the values from the input fields and store them in a taskObj object. Each task should also have a unique id.

Create a taskObj object with an id property as the first property. For the value of the id property, retrieve the value of the titleInput field, convert it to lowercase, and then use the split() and join() methods to hyphenate it.

Make sure all of those are in template literals because you need the id property value as a string.

my code:
const taskObj = {
id: ${titleInput.value.toLowerCase().split(' ').join('-')}-${Date.now()},
title: titleValue,
date: dateValue,
description: descriptionValue,
};

Response:
Sorry, your code does not pass. Keep trying.

You should use .join('-') on titleInput.value.toLowerCase().split(' ').

Please I need help on the above

The line above needs to be in template literal. So you need to add backticks to the beginning and end of that part of your code. For example, compare the two lines below:

${someValue}

`${someValue}`

Notice the `` (not a quotation mark) in the second line. These are known as backticks, and on your keyboard, you can find it below the β€œEsc” key. I hope this helps.

2 Likes

These tests can be fussy.

What step are you on?

Step 12 just wants the id property without the Date.now()
Step 13 adds the Date.now()
Step 14 adds the title, date and description

1 Like

Thank you @ambradnum . Issue resolved according to your guide. I appreciate