Among the 7 variables - rodeo, saya, balthazar, mistral, luna, calypso, and kiara - each holds a value obtained from calculations in the initial part of my program.
My goal is to arrange these variables in ascending order based on the values they contain, while still being able to differentiate them by name.
I am currently in the process of creating a website for my 11-year-old daughter using Wix.
var points = [rodeo, mistral, calypso, kiara, balthazar, saya, luna];
points.sort(function(a, b){return a-b});
console.log(points)
Running this code gives me:
0: 2
1: 2
2: 2
3: 2
4: 3
5: 3
6: 4
Although the ranking is correct, I am unable to determine which value corresponds to each variable, which is the issue I am currently facing.