I am working with an array of objects.
resources=[{name:'x', title:'xx',..},{name:'y',title:'yy',..}..]
To populate my HTML tooltip, I am pushing all the titles from the resources
array to a new array.
dialogOkClick(field) {
this.resources.forEach((res) => {
if(this.selectedItems.indexOf(res.title) === -1) {
this.selectedItems.push(res.title);
this.tooltipText = this.selectedItems.join(', ');
}
});
}
The process of pushing individual items to a new array is causing inconsistency between the two arrays. Is there a way to clone all the titles to a new array simultaneously instead of pushing each item one by one?
Thank You!