Ok so I believe there was a miscommunication in the post. Here is a more solid example.
Lets say I want to check if a name has a common ending. I'm using endsWith, and so to check it would look something like the following
By accepting an array as an argument, it could be combined. Now the counter argument of breaking existing code is a good point, however, I'm sure that if we're modifying these functions we can account for that possibility with simply checking if the argument passed is an array or a string, or even allowing for a new option if need be.
Are there other languages that have over loaded their string predicates in this way, being able to use arrays as alternative inputs? Is a benefit that it would be familiar to people coming to JS from those languages?
I don't know the answers to your question, however, I don't think that js should be a the mercy of other languages who have their own quirks. Like how python uses spaces in place of curly brackets or a length function as opposed to a property. Thank you for the work around.