Use slice, as such:
var ar = [1,2,3,4,5,6];
var p1 = ar.slice(0,4);
var p2 = ar.slice(4);
More Related Contents:
- Javascript Array – Split string at numbers [closed]
- Split array into chunks
- How can I split a string into segments of n characters?
- JavaScript split String with white space
- String split returns an array with more elements than expected (empty elements)
- What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
- Converting a JS object to an array using jQuery
- Most efficient way to convert an HTMLCollection to an Array
- Passing an array as a function parameter in JavaScript
- Merge JavaScript objects in array with same key
- Merge multiple objects inside the same array into one object [duplicate]
- How do I zip two arrays in JavaScript?
- How do I sort an array of objects based on the ordering of another array?
- JavaScript – get array element fulfilling a condition
- Length of a JavaScript associative array
- Add a property to a JavaScript array
- Javascript recursive array flattening
- How to free up the memory in JavaScript
- Trying to capitalize the first character in array of strings, why this is not working?
- Removing undefined values from Array
- How to remove duplicates from a two-dimensional array? [closed]
- Javascript – sorting array by multiple criteria
- spread operator vs array.concat()
- How to get an Array with jQuery, multiple with the same name
- Sort a Javascript Array by frequency and then filter repeats
- How can I loop through enum values for display in radio buttons? [duplicate]
- Javascript array search and remove string?
- Using jQuery inArray with array of JavaScript Objects
- best way to generate empty 2D array
- Should negative indexes in JavaScript arrays contribute to array length?