-
-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
feat(curriculum): add maps and sets workshop to FSD cert #57189
base: main
Are you sure you want to change the base?
Conversation
…nto plant-nursery-catalog
.../english/25-front-end-development/workshop-plant-nursery-catalog/6734ab61e916486c80c490d1.md
Show resolved
Hide resolved
I see the Edit: I do understand in the cases where you switch out a function implementation and switch it back. But the others are losing me. |
If I don't do that, following tests fail because Probably I should find a better way to test this. It seems a bit precarious. |
I like tests to be isolated when possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lotta fun @Dario-DC 🎉 Maybe we should rename this module to "plants, maps and sets" 😄 I left a number of comments to try and make things a bit more clear in some spots. They're just suggestions, feel free to leave them if you think it's fine.
.../english/25-front-end-development/workshop-plant-nursery-catalog/67349ba230cff237c0f2bdf2.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/6734a2385c52c54d916a8b86.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/673339d96c56d36e963e888e.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/6733b5632fb854bc6c58dc0d.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/6733b5e6f210c1bd1afdf8b3.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/673762590f4bc1771c3a1e97.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/673521668be7905059b2d555.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/6737a95d5b431860f96ca7bb.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/6738ad2fd11775752d23ddc2.md
Outdated
Show resolved
Hide resolved
|
||
To complete this workshop, modify your `displayPlantsSet` to return a set with the unique plant common names in your catalog. | ||
|
||
To achieve it, create an array containing the `commonName` of each plant object stored as a key of the `catalog` map. Pass the array to the `Set` constructor and return the set from the function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To achieve it, create an array containing the `commonName` of each plant object stored as a key of the `catalog` map. Pass the array to the `Set` constructor and return the set from the function. | |
To achieve this, create an array of unique `commonName` values from your `catalog` keys. Pass the array to the `Set` constructor and return the set from the function. |
I'm not sure if this is any better. Here's the solution I came up with:
code
const displayPlantsSet = () => {
const uniqueCommonNames = [];
catalog.forEach((val, key) => {
if (!uniqueCommonNames.includes(key.commonName)) {
uniqueCommonNames.push(key.commonName)
}
})
const catalogSet = new Set(uniqueCommonNames);
return catalogSet
};
Could maybe mention to remove the add
methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was to create an array with all the common names, without caring about repetitions. Then use the set constructor to get the unique values. Should I clarify that?
Anyway I'm checking just the final result.
Co-authored-by: Tom <[email protected]>
…nto plant-nursery-catalog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had fun doing this workshop!
Left a few suggestions 👍️
.../english/25-front-end-development/workshop-plant-nursery-catalog/6734bbc0bd741598f942352e.md
Outdated
Show resolved
Hide resolved
.../english/25-front-end-development/workshop-plant-nursery-catalog/6734c10a327760a665b7d5b9.md
Outdated
Show resolved
Hide resolved
…nto plant-nursery-catalog
Checklist:
main
branch of freeCodeCamp.Closes freeCodeCamp/CurriculumExpansion#653