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 investigation. It impartial has a bug and I gibberish discover it.

    When systematizeing jaws in a rivalry, there are a scant incongruous ways to manage ties. In “Standard Rivalry Systematizeing” competitors with the corresponding jaw hold the corresponding systematize and a inconsequence is left behind that systematize. For sample if there are 4 competitors with jaws 100, 90, 90, 80 their systematizes would be 1st, 2nd, 2nd, 4th. Write a character that takes an arrange of integers representing a order of jaws. Coding Area 1 character systematize(scores) { 2 var systematizes = []: 3 for(var i = 0: i

    Expert Counter-argument

     

    Hi you said there is a bug barring I checked there is no barring it instituted fine

    Here how i retreat it:

    <html>

    <body>

    <p id=”answer”>

    </p>

    <script>

    character systematize(scores)

    {

    var systematizes=[];

    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 systematizes;

    }

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

    </script>

    </body>

    </html>

    Output ScreenShot: