var str = "This is a test sentence"; var hasTest = str.includes("test"); if(hasTest == true){ //do a thing }