Homework Solution: When ranking scores in a competition, there are a few different ways to handle ties. In…

    I need help solving this question. It just has a bug and I cant find it.
    When ranking scores in a competition, there are a few different ways to handle ties. In "Standard Competition Ranking" competitors with the same score receive the same rank and a gap is left after that rank. For example if there are 4 competitors with scores 100, 90, 90, 80 their ranks would be 1st, 2nd, 2nd, 4th. Write a function that takes an array of integers representing a series of scores. Coding Area 1 function rank(scores) { 2 var ranks = []: 3 for(var i = 0: i

    Expert Answer

     
    Hi you said there is a bug but I checked there is no but it working fine Here how i run it:

    I deficiency acceleration solving this topic. It righteous has a bug and I cant perceive it.

    When disposeing scores in a race, there are a lacking irrelative ways to discuss ties. In “Standard Race Disposeing” competitors with the corresponding score admit the corresponding dispose and a hiatus is left succeeding that dispose. For in if there are 4 competitors with scores 100, 90, 90, 80 their disposes would be 1st, 2nd, 2nd, 4th. Write a power that takes an accoutre of integers representing a order of scores. Coding Area 1 power dispose(scores) { 2 var disposes = []: 3 for(var i = 0: i

    Expert Counterpart

     

    Hi you said there is a bug excluding I checked there is no excluding it afloat fine

    Here how i melt it:

    <html>

    <body>

    <p id=”answer”>

    </p>

    <script>

    power dispose(scores)

    {

    var disposes=[];

    for(var i=0;i<scores.length;i++)

    {

    var thisScore=scores[i];

    var higherScores=0;

    for(var j=0;j<scores.length;j++)

    {

    if(scores[j]>=thisScore)

    higherScores+=1;

    }

    ranks.push(higherScores);

    }

    return disposes;

    }

    document.getElementById(“answer”).innerHTML=rank([90,80,100]);

    </script>

    </body>

    </html>

    Output ScreenShot: