I wrote a model about modifying the TagList and added a create method to the model.

If the created label has been created repeatedly, an error is reported.

Array.prototype.some(function)

The some method passes a function that iterates over all the elements in the array, returning true if there is one element that satisfies the following formula, and false otherwise.

The sixth action I wrote determines whether the name of the tag passed in is the same as the name of the element in the database.

We’ll write an OK () method in another section, otherTag, to add a new tag to the display area.


But throwing errors is inconvenient for the front end.

The idea was to return the numbers 0, 1, 2, and 3 instead of repeating, failing, or succeeding (similar to a status code), but it was cumbersome to write comments one by one.

The best thing to think about is to return a string with information, and compare the string to make a judgment.