1let arr =["a","b","c"];
2// ES6 way
3const copy = [...arr];
4
5// older method
6const copy = Array.from(arr);
1let shallowCopy = fruits.slice() // this is how to make a copy
2// ["Strawberry", "Mango"]
3
1// Copy an array
2fn main() {
3 let arr = ["a","b","c"];
4 let mut another = arr.clone(); // make a copy
5 println!("copy of arr = {:?} ", another);
6 another[1] = "d"; // make a change
7 assert_eq!(arr, another); // panic, no longer equal
8}