Short answer, what you’re doing was wrong, and you can get upset if you want, but it’s stopping your program because you’re doing something illegal, accessing a method that doesn’t exist. I’m thankful to be informed from my mistakes, especially when jumping between API’s all the time, and I’m not always referencing the documentation, it’s easy to make this mistake.
All the join method does is iterate over an iterable object adding a given string between the entries, concatenated to a new string, and returning that string. It appears under the judgement of who develops the API’s, this was unnecessary for strings.
String has it’s own similar methods, such as
String.replace() which can do the following
let str = "Amen";
str = str.replace("me", "gai"); // "Again"
There is no
String.join() method, but you can add the
Array.join() to the
String object. There is no telling what consequences this may bring as the method is designed to work on arrays, but it appears to work somewhat.
String.prototype.join = Array.prototype.join;
"Amen".join(","); // "A,m,e,n,"
Your best bet, as always, is to learn and understand what you’re doing. Troubleshooting is part of the job and and such behavior is in place to protect us from our own mistakes, because we’re fallible.