JSFiddle - React, Tailwind, and code Playground

by Luke Arrington

HTML

<body>

<p>Click the button to display the array values after the split.</p>

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

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

<script>
function myFunction() {
    var str = "How are you doing today?";
    var res = str.split("");
    document.getElementById("demo").innerHTML = res;
}
</script>

<button onclick="myFunction2()">Try it</button>
<p id="demo2"></p>
<script>
function myFunction2() {
    var str1 = "How are you doing today?";
    var res1 = str1.split(" ");
    document.getElementById("demo2").innerHTML = res1;
}
</script>

</body>