Skip to content
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

Preventing array from storing duplicate values #2894

Open
sosmongare opened this issue Oct 16, 2021 · 1 comment
Open

Preventing array from storing duplicate values #2894

sosmongare opened this issue Oct 16, 2021 · 1 comment

Comments

@sosmongare
Copy link

On the todo app, How do I prevent an array from duplicating the etext i have just inserted

@dammy001
Copy link

@sosmongare you can just find the index of that value first using find or indexOf before updating the array

['m', 'I', 'j'].find(data => data === value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants