JSFiddle - React, Tailwind, and code Playground

by Oliver Ni

HTML

<!DOCTYPE html>
String contains substring example:

JavaScript

function strstr(str, substr) {
    if (str.indexOf(substr) !== -1)
        alert("The string ' " + str + " ' contains the substring ' " + substr + " '!");
    else
        alert("The string ' " + str + " ' does not contain the substring ' " + substr + " '!");
}
var str = prompt("What is the string?");
var substr = prompt("What is the substring?");
strstr(str, substr);