![]() ![]() For example, I do it when I need to check if a specific class is applied to an element, or if a return value of a function matches one of multiple values. The main problemĬhecking if a given thing is in a list is a common action in JavaScript (for me at least). ![]() So I’m writing this for my own reference. You see, there are three possible options: includes(), contains() and has() and I mix them up all the time. Every single time I need to look up the function that does that for the sort of list I’m working with. When writing JavaScript, very frequently I need to check if a given thing exists in a list of things.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |