Use the limit parameter: - Javascript String

Javascript examples for String:split


Use the limit parameter:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

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

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

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


Related Tutorials