The following is the code in typescript,
count: number;
this.count is accessed from html component.
console.log(this.count) gives me 5.
var arrObj:number[] = new Array(this.count)
console.log(arrObj.length);
Here the length of the array is always 1.
var arrObj:number[] = new Array(5)
console.log(arrObj.length);
Output: 5
var arrObj:number[] = new Array(this.count)
console.log(arrObj.length);
Output:1
Why is the global variable length is always 1?