CorinaMurg / html-tag-quiz

A quiz to help you learn and test your knowledge of HTML tags. Open source.
https://html-tag-quiz.netlify.app/
MIT License
8 stars 10 forks source link

create function to prevent duplication #36

Closed YuriDevAT closed 1 year ago

YuriDevAT commented 1 year ago

Description

The function created prevents from duplication of list items. Each tag can now only be added once.

This PR closes issue #12

Functionality

I am using the forEach() array function on the newly created list and compare the input I am going to make with all the list items already in the list. If the tag is in the list, then it is not added. If the tag is not in the list, then it is added.

Thoughts / Help

Actually, my first thought was using the include() function on the array stored in localStorage, but I could not make it work. My thoughts were: If the tag I want to enter in the input field is already in the list, then don't add it to the list.

I would love to get a hint in case my thoughts make sense and I simply made a mistake in the code, than I would give it another try. 🤗

netlify[bot] commented 1 year ago

Deploy Preview for html-tag-quiz ready!

Name Link
Latest commit 24f09153f9c47047774c3033c0b1fa7c6eff3341
Latest deploy log https://app.netlify.com/sites/html-tag-quiz/deploys/653f30e91b45ba000811ecf2
Deploy Preview https://deploy-preview-36--html-tag-quiz.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.