You are viewing a single comment's thread. Return to all comments →
For Javascript, try not to overthink this. It's beginner so for loop, if...else if, comparisons, will do.
function compareTriplets(a, b) { let scoreA = 0; let scoreB = 0; for (let i=0;i<3;i++) { if (a[i] > b[i]) { scoreA = scoreA + 1; } else if (a[i] < b[i]) { scoreB = scoreB + 1; } } return [scoreA, scoreB] }
Seems like cookies are disabled on this browser, please enable them to open this website
Compare the Triplets
You are viewing a single comment's thread. Return to all comments →
For Javascript, try not to overthink this. It's beginner so for loop, if...else if, comparisons, will do.