Comments (10)
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.
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.
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.
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.
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.
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.
Hello. I am new to open source. Can you help with the folder that produces this code on the codebase.
from freecodecamp.
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.
This issue is not open for contribution.
Please look into issues marked with the help-wanted or first-timers-only label
thanks
from freecodecamp.
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)
- Typo in Step 43 of Building a Cipher HOT 4
- js beta rpg step 23 - code check doesn't accept shorthand margin specification HOT 1
- Wrap keywords inside backticks in Step 51 of Building a Cipher HOT 1
- 1111
- Contributing guidelines landing page redirects to incorrect link HOT 3
- js beta build a RPG step 150 and step 151 can be combined HOT 3
- No link to go back to homepage HOT 2
- Update step 18, 28, 38 hints for calorie counter project HOT 5
- [Building a Cipher] Introduction to code comment seems to be out of sequence HOT 2
- GitPod doesn't allow creationg of account from many countries
- GET /api/users/exists?username=...
- Cracking the coding interview section for FreeCodeCamp HOT 2
- SCWP(Beta) - Learn Classes and Objects by Building a Sudoku Solver - Step 73: Accepting wrong solution HOT 1
- RD Certification - Learn Git by Building an SQL Reference Object: Typo HOT 3
- Adding Labels to learning content in tutorials
- Submit and go to next challenge button Hover effect not working HOT 6
- Getting JS Certificate HOT 1
- Nutrition Table - Step 4 | insufficient test case HOT 1
- Monaco Vim Support HOT 3
- Inconsistent uses of "a" and "an" HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freecodecamp.