JSFiddle - React, Tailwind, and code Playground

HTML

<span id="js">www.example.com</span>

JavaScript

var text = $('#js').text(),
    reg = text.indexOf('.com');

if(reg != -1){
    console.log('The text contain .com');
}else {
    console.log("The text doesn't contain .com");
}