Sometimes, we want to fix string.split is not a function with JavaScript.
In this article, we’ll look at how to fix string.split is not a function with JavaScript.
How to fix string.split is not a function with JavaScript?
To fix string.split is not a function with JavaScript, we should make sure we’re calling split on a string.
For instance, we write
const string = document.location.toString();
to convert document.location to a string with toString before we call split on it.
Conclusion
To fix string.split is not a function with JavaScript, we should make sure we’re calling split on a string.
