Array.prototype.valuesbeginnerconst fruits = ['apple', 'banana', 'cherry']
for (const v of fruits.values()) {
console.log(v) // apple, banana, cherry
}Use values() with for-of to iterate over all element values of an array.
The iterator returned by values() can be consumed with a for...of loop, giving you each element one at a time.
Implement collectValues which uses a for...of loop on arr.values() to collect all elements into a new array.