I'm trying to rewrite my mobile apps using the latest Angular 6/Ionic 4. I just can't seem to get a basic forEach working. I'm trying all types of ways, but Sublime Text & Angular CLI throws errors. Please see the screenshot below. You can see the red squiggly lines in the Sublime Text Editor. The error is commented above each code block. Does anyone have any idea where I'm going wrong?
Thanks for your time - please don't hesitate to let me know if you need additional info.
array = [1, 2, 3];
// Duplicate identifier 'array'. -- Parameter declaration expected.
array.forEach(function(element) {
console.log(element);
})
// Unexpected token. A constructor, method, accessor, or property was expected.
this.array.forEach((key : any, val: any) => {
console.log(val);
})
// Cannot find name 'array'. Did you mean 'Array'?
array.forEach((key : any, val: any) => {
console.log(val);
})
// Cannot find name 'array'. Did you mean 'Array'?
for (let number of array) {
console.log(number);
}

let array = [...]?