HOW TO SPLIT AN ARRAY JAVASCRIPT

JavaScript
//split into array of strings.
var str = "Well, how, are , we , doing, today";
var res = str.split(",");array.splice(index, number, item1, ....., itemN)
// Example array.
let randomArray = [3, 5, 1, 5, 7,];
// Create an empty array.
let arrayOfArrays = [];

function splitArray( array ) {
    while (array.length > 0) {
        let arrayElement = array.splice(0,1);
        arrayOfArrays.push(arrayElement);
    }
    return arrayOfArrays;
}

// Call the function while passing in an array of your choice.
splitArray(randomArray)
// => [ [ 3 ], [ 5 ], [ 1 ], [ 5 ], [ 7 ] ]
Source

Also in JavaScript: