Do you want to explode or split a string in JavaScript

If you want to break the string by space or certain character so you can use javascript split() function for this. Below is the example to split/break the string through space.

<script type="text/javascript">
        var StringtoBreak = "The quick brown fox jumps over the lazy dog.";
        var stringArray = StringtoBreak.split(" ");
 
    </script>

You can also limit the split function so I can only split the sting with number of occurrence and leave the remaining string after that.

<script type="text/javascript">
        var StringtoBreak = "The quick brown fox jumps over the lazy dog.";
        var stringArray = StringtoBreak.split(" ",2);
 
    </script>

Above code will split the string with only first 2 occurrence and leave the remaining string in third element of the array.