Use a letter as a separator: - Javascript String

Javascript examples for String:split


Use a letter as a separator:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>

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

function myFunction() {//  w  ww  .j av  a 2s.  c o m
    var str = "The following code shows how to ?";
    var res = str.split("o");
    document.getElementById("demo").innerHTML = res;


Related Tutorials