Link to home
Start Free TrialLog in
Avatar of juan field
juan field

asked on

how can i break an array into a couple

from this
var arr= [apples, banana, oranges, kiwi];

to this
var newArr = [[apples, banana], [oranges, kiwi]];
Avatar of juan field
juan field


// this is good , just wanted to hear another opinion. Thank you.

var results = [];
  while (array.length) {
    results.push(array.splice(0, size));
  return results;
Juan, are you having a conversation with yourself :)

I don't see how the comment you posted fits with your question.
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you so much
You are most welcome.