I have the following weird issue on my code using Typescript 2.6. I 'm trying to loop through a Set of string values but I get the following error and I don't understand why.
'Type 'Set' is not an array type or a string type. '
Here is what I have:
loopThroughSet(): void {
let fruitSet = new Set()
.add('APPLE')
.add('ORANGE')
.add('MANGO');
for (let fruit of fruitSet) {
console.log(fruit);
}
}
Does anyone knows what's the problem? Thanks in advance