I know what startsWith() does in js. Is there a method that checks opposite of what startsWith() does?? Something like "notstartsWith()". I want a method that would return false if a string starts with a pattern and true if it doesn't.
Use startsWith with the string you want to check against, then invert the check with !:
if (!str.startsWith('foo')) {
// string does not start with foo
}
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