Learn-basic-oop-by-building-a-shopping-cart - Step 28

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-oop-by-building-a-shopping-cart/step-28
Current Code

currentProductCount > 1 ? (currentProductCountSpan.textContent = `${currentProductCount}x`) : undefined;

fCC test error message “You should use template literal syntax to update the textContent to be ${currentProductCount}x.”
Can someone at fCC please explain the error message given; and where a template literal has not been used in my code.
Thank you.

You should remove the parentheses around the assignment.

Happy coding!

hi Femincan, thank you so much for you advice. Are you able to explain to me why the parentheses need to be removed?

the tests don’t account for their presence, so it fails.

I did not even know that you could assign a value to a variable within a ternary conditional statement.

I was trying to assign both the truthy or falsy statements to the required property, like this, but it was not working:

object.property = condition ? true : false

Thank you for posting this.