Use a letter as a separator: - Javascript String

Javascript examples for String:split

Description

Use a letter as a separator:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
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;
}
</script>

</body>
</html>

Related Tutorials