Open mahyuan opened 6 years ago
function splitArray (arr, n) { if(arr instanceof Array && arr.length) { if(arr.length < n) { return arr } else { let a = [...arr] a.length = n return a } } return [] }