Say I have an Object with an array on it like so someObj.myArray.someFunc, how do you use the spread operator on it?
I'v tried myObj....myArray.someFunc() , myObj[...myArray].someFunc and
myArray = myObj.myArray ...myArray.someFunc
Say I have an Object with an array on it like so someObj.myArray.someFunc, how do you use the spread operator on it?
I'v tried myObj....myArray.someFunc() , myObj[...myArray].someFunc and
myArray = myObj.myArray ...myArray.someFunc
I suppose someFunc is method of Array.prototype (e.g. forEach, map, ...):
[...myObj.myArray].someFunc;
However, if someFunc is method of object in array, you can iterate array and just call it. E.g.:
myObj.myArray.forEach(item => item.someFunc());