I know this has been put out too many times, but none of the questions fix the problem I have. It gives me the following error every time I run the function:
TypeError: Cannot read property 'toLowerCase' of undefined
Here's the code it's running:
global.toId = function(text) {
return text.toLowerCase().replace(/[^a-z0-9]/g, '');
};
In ES2020, you can use optional chaining (?.)
global.toId = function(text) {
return text?.toLowerCase().replace(/[^a-z0-9]/g, '');
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With