How do I copy contents of an array to another array.
I have 2 arrays foo and bar, please have a look below:
foo = [] //this is a temp array which will be generated in a loop
bar = []
for(someCondition){
for(someOtherCondition){
foo = assignSomething;
}
// here I want the content of foo to be added to bar array and keep appending to the existing array
//I tried bar.push(foo) but this just creates an array of foo's but doesn't copy the foo array into bar array.
//I also tried bar = foo.slice() but this just replaces the bar array everytime with new data
}
Thanks for the help.