Skip to content
Advertisement

How to add an item only if no other items exist with the same name in the arraylist?

How would I go about only inserting an item if the item does not have the same name as the other items in the arraylist within my insertUniqueItem() method?

JavaScript

Advertisement

Answer

You need to check if an item with the same name already exists in your list:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement