Learn localStorage by Building a Todo App - Step 17

Tell us what’s happening:

Hi, I have added template literals in to the code ` and have added an imbedded expression ${} what am I doing wrong as there is a syntax error which shows:

SyntaxError: Unknown: Unexpected token, expected "," (37:9)
35 |
36 | const taskObj { 
>37 | id: ${`titleInput.value.toLowerCase().split(" ").join("-")`}
| ^ 
38 |}; 
39 | console.log(taskObj); 
40 | });`

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

    id: ${`titleInput.value.toLowerCase().split(" ").join("-")`}

// User Editable Region

Your browser information:

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

Challenge Information:

Learn localStorage by Building a Todo App - Step 17

your ${} should be inside the backticks, you need to move them out.

Example:

let name = "esterwalf";
console.log(`${name + " is a camper at freeCodeCamp!"}`);