JSFiddle - React, Tailwind, and code Playground

by Thomas Jackson

HTML

<html>
<body>

<p>Click the button to locate where in the string a specifed value occurs.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
	document.getElementById("demo").innerHTML = '';
   // var str = "Hello world, welcome to the universe.";
    var str = { "Tom" : "good", "Howard" : "bad" };
    str = JSON.stringify(str);
    var n = str.indexOf("Tom");
    document.getElementById("demo").innerHTML = n;
}
</script>

</body>
</html>