I can't convert array's numbers into strings. What is wrong with my code?
I also tried: this.userIds.toString().split(',')
collectIds() {
this.array.forEach((e, i) => {
// [8, 8, 8, undefined, undefined, undefined]
if (this.array[i].details.user_id !== undefined) {
this.userIds.push(this.array[i].details.user_id)
// [8, 8, 8]
}
});
this.userIds.map(e => e.toString())
console.log("userIds: ", this.userIds)
// [8, 8, 8]
}
this.userIds = this.array.filter( x => x!== undefined).map(x => x.toString());