How can I return the values of an array? The methods .values() and .entries() seem to return an Array Iterator. This is not what I want. I am also not allowed to modify func1() function for this edge case.
const test = func1();
console.log(test); // actual: [[1,2]] what I want: [1,2]
function func1() { // not allowed to modify func1
return [func2()];
}
function func2() {
const set = new Set();
set.add(1);
set.add(2);
return Array.from(set);
// return Array.from(set).values() returns Array Iterator
}
Thanks!
func1().flat();.func1always returns an array, so it doesn't matter whatfunc2returns.