Struggling with writing a simple for loop in TypeScript:
j: any;
x = [1, 2, 3, 4, 5, 6, 7];
for(j in x){
console.log(x[j]);
}
Encountering numerous errors even when utilizing the 'this' keyword: 1. '=' expected. 2. Cannot find name 'j'. 3. Module parse failed: You may need an appropriate loader to handle this file type.
| this.x = [1, 2, 3, 4, 5, 6, 7]; | } |
PlanningComponent.prototype.for = function (let) { | if (let === void 0) { let = j in this.x; } | console.log(this.x[j]);
4. Duplicate identifier j. 5. Unexpected token.
Seeking guidance on correcting my mistakes.