Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Strings</h1>
<h2>The split() Method</h2>
<p>split() splits a string into an array of substrings, and returns the array.</p>
<p>The second word is:</p>
<p id="demo"></p>
<script>
let text = "How are you doing today?";
const myArray = text.split(" ");
document.getElementById("demo").innerHTML = myArray[1]; 
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_split1 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:26 GMT -->
</html>