Let's say you have an array like this:
//Input
[1,2,3,4,5,6,7]
How to write the function which will get us the output of
//Output
Array1 = [1]
Array2 = [1,2]
Array3 = [1,2,3]
Array4 = [1,2,3,4]
Array5 = [1,2,3,4,5]
And
//Output
1. [1,1,2,1,2,3,1,2,3,4...]
// tried this
for (i = 0; i < arr.length; i++) {
arr = new Array(arr[i]);
}
**********?