Open this example in the interactive library
Source code
const scores = [10, 8, 8, 6];
console.log(scores.map((v) => 1 + scores.filter((s) => s > v).length));
Sample output
[ 1, 2, 2, 4 ]

Open this example in the interactive library
const scores = [10, 8, 8, 6];
console.log(scores.map((v) => 1 + scores.filter((s) => s > v).length));
[ 1, 2, 2, 4 ]