-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaScript Algorithms and Data Structures (Beta) - Step 13 #54795
Comments
Here are the new const products = [
{
id: "vanilla-cupcake-pack",
name: "Vanilla Cupcakes (6 Pack)",
price: 12.99,
category: "Cupcake",
},
{
id: "french-macaron",
name: "French Macaron",
price: 3.99,
category: "Macaron",
},
{
id: "pumpkin-cupcake",
name: "Pumpkin Cupcake",
price: 3.99,
category: "Cupcake",
},
{
id: "chocolate-cupcake",
name: "Chocolate Cupcake",
price: 5.99,
category: "Cupcake",
},
{
id: "chocolate-pretzel-pack",
name: "Chocolate Pretzels (4 Pack)",
price: 10.99,
category: "Pretzel",
},
{
id: "strawberry-ice-cream",
name: "Strawberry Ice Cream",
price: 2.99,
category: "Ice Cream",
},
{
id: "chocolate-macaron-pack",
name: "Chocolate Macarons (4 Pack)",
price: 9.99,
category: "Macaron",
},
{
id: "strawberry-pretzel",
name: "Strawberry Pretzel",
price: 4.99,
category: "Pretzel",
},
{
id: "pecan-ice-cream",
name: "Butter Pecan Ice Cream",
price: 2.99,
category: "Ice Cream",
},
{
id: "rocky-road",
name: "Rocky Road Ice Cream",
price: 2.99,
category: "Ice Cream",
},
{
id: "vanilla-macaron-pack",
name: "Vanilla Macarons (5 Pack)",
price: 11.99,
category: "Macaron",
},
{
id: "lemon-cupcakes-pack",
name: "Lemon Cupcakes (4 Pack)",
price: 12.99,
category: "Cupcake",
},
]; |
I am removing the help wanted label for now. It looks like updating the ids will also affect some of the logic for the methods like here. const product = products.find((item) => item.id); instead of const product = products.find((item) => item.id === id); And there will probably be other changes needed too. This is just after a quick glance at the project. I'll wait to hear from the other members to see if this should be opened up for help wanted or just handled by a team member to make sure the core functionality is still in place. |
Wait hang on, how is this not valid?
Everything mentioned in MDN as a "reason not to do this" is not really relevant to this project, because we aren't using these IDs as a selector. |
Yeah, I was reading this part of MDN
But if that doesn't apply in this situation, then we shouldn't move forward with this change because it would mean updating other parts of the functionality |
I should have written Edit: Not trying to be argumentative at all. |
Honestly, in this case I don't think so. It's pretty common to use numbers as IDs when you're doing things like mapping an array to a bunch of elements. |
Hello. I am new to open source. Can you help with the folder that produces this code on the codebase. |
I think I figured it. |
This issue is not open for contribution. Please look into issues marked with the help-wanted or first-timers-only label |
Although using |
I think we should close the issue with the reason you've given. What do you think, @naomi-lgbt? |
Agreed. |
Describe the Issue
A button id is set to a number, which is not valid HTML.
Affected Page
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-oop-by-building-a-shopping-cart/step-13
Your code
Expected behavior
The
id
attribute for the button with the class ofbtn add-to-cart-btn
should likely follow best practices and not have anid
that begins with a number.https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
Screenshots
No response
System
Additional context
The
products
array has been shortened in order to make the code more legible in the Your Code section.The text was updated successfully, but these errors were encountered: