JSFiddle - React, Tailwind, and code Playground

by 15012917

HTML

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript String Methods</h2>

<p>The indexOf() method returns the position of the first occurrence of a specified text:</p>

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

</body>
</html>

JavaScript

//Mabel Velasco Menéndez Actividad 1.6
var str = "Please locate where 'locate' occurs!";
var pos = str.indexOf("locate");
document.getElementById("demo").innerHTML = pos;