Just wondering if garbage collector takes care of an array returned by function. Will this function cause memory leaks if called many times?
1. myFun = () => {
2. let data = []
3. for (let i=1; i<5; i++){
4. data.push(id: i, name: 'temp')
5. }
6. return data
7. }
8.
9. let myData1 = myFun()
10. let myData2 = myFun()
11. let myData3 = myFun()
so it creates three new arrays. But what the one defined in row #2?