Giter Club home page Giter Club logo

Comments (10)

jdwilkin4 avatar jdwilkin4 commented on June 1, 2024

Here are the new ids for the products

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",
  },
];

from freecodecamp.

jdwilkin4 avatar jdwilkin4 commented on June 1, 2024

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.
This would need to be updated to the just check for the id

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.

from freecodecamp.

naomi-lgbt avatar naomi-lgbt commented on June 1, 2024

Wait hang on, how is this not valid?

Technically, the value for an id attribute may contain any character, except whitespace characters. However, to avoid inadvertent errors, only ASCII letters, digits, '_', and '-' should be used, and the value for an id attribute should start with a letter.

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.

from freecodecamp.

jdwilkin4 avatar jdwilkin4 commented on June 1, 2024

Yeah, I was reading this part of MDN

id attribute should start with a letter.

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

from freecodecamp.

smykes avatar smykes commented on June 1, 2024

I should have written is not best practice instead of is not valid. If I remember correctly older specs, maybe XHTML used to fail in the WC3 validator if an ID did start with a number. Apparently it doesn't even give a warning anymore. @naomi-lgbt is that relevant since the aim is to teach best practices and this could lead students to use this strategy in other projects outside of Free Code Camp? I know it's not a small fix, I just wanted to bring it up.

Edit: Not trying to be argumentative at all.

from freecodecamp.

naomi-lgbt avatar naomi-lgbt commented on June 1, 2024

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.

from freecodecamp.

princeonyekah avatar princeonyekah commented on June 1, 2024

Hello. I am new to open source. Can you help with the folder that produces this code on the codebase.

from freecodecamp.

princeonyekah avatar princeonyekah commented on June 1, 2024

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.

from freecodecamp.

jdwilkin4 avatar jdwilkin4 commented on June 1, 2024

@princeonyekah

This issue is not open for contribution.

Please look into issues marked with the help-wanted or first-timers-only label
thanks

from freecodecamp.

Supravisor avatar Supravisor commented on June 1, 2024

Although using id as a number is valid JavaScript, Campers may become confused as they are first taught id as an attribute.
How about renaming id to something else, such as identifier or dessert?

from freecodecamp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.