Вы можете просто создать два связанных массива (ассоциативных массива), которые выглядят следующим образом:
data: object = {
dataTypes: ['Career', 'Finances', 'Personal Growth', 'Health', 'Family', 'Relationships', 'Social Life', 'Attitude'],
dataValues: [3, 4, 7, 2, 5, 6, 8, 8],
}
Затем получите наименьший балл:
lowestScore: Math.min(this.dataValues),
lowestScoreIndex: this.dataValues.indexOf(this.lowestScore);
И задайте имя наименьшегооценка:
lowestScoreName: this.dataTypes[lowestScoreIndex]
И все!Вот полный объект:
data: object = {
dataTypes: ['Career', 'Finances', 'Personal Growth', 'Health', 'Family', 'Relationships', 'Social Life', 'Attitude'],
dataValues: [3, 4, 7, 2, 5, 6, 8, 8],
lowestScore: Math.min(this.dataValues),
lowestScoreIndex: this.dataValues.indexOf(this.lowestScore);
lowestScoreName: this.dataTypes[lowestScoreIndex]
}