I have a quick question.
How do I check whether there are any commas or dashes in a string? Thx
/[,\-]/.test(yourString)
this returns true if yourString contains commas or dashes or false otherwise.
/(,|-)/.test(yourString); // returns true if there are commas or dashes in the string, false otherwise.
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