I have an array like
var array = ['a','b','c','d','e','f','g','h','i'];
I need to display based on the following 2 conditions.
1) If I pass an array to a function like, function(array,2) then the array should display like [[a,b],[c,d],[e,f],[g,h],[i]]
.
2) If I pass an array to a function like, function(array,3) then the array should display like [[a,b,c],[d,e,f],[g,h,i]]
.
How this can be achievable using javascript? Please help me, thanks in advance.