Just realized it exists, thanks to VSCode enforcing it...
Usage
let regex = /hot/g;
let phrase = "It's hot, outside.";
// you don't need to worry about null
let matches = phrase.match(regex)?.length;
That feature is called optional chaining. This calls the method when the receiver is neither undefined nor null.
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