I am currently iterating through an array and adding the key to my panels array. I am getting the correct length of the array which is three but my parseint is displaying NaN. How can I convert the key which is a string to an int to display panel-0 for example instead of panel-NaN.
Object.keys(this.Category).forEach((key) => {
this.panels.push(parseInt(key, 3));
this.activeIds = this.panels.map(p => 'panel-' + p);
});```
what you are doing is parseInt('Car' 3)
, since "Car" is not a number you will get NaN
probaby you want something like this:
Object.keys(this.Category).forEach((key) => {
this.panels.push('panel-' + panels.length + 1);
});