Sort by

recency

|

198 Discussions

|

  • + 0 comments
    function getGrade(score) {
        let grade;
        // Write your code here
        
        if(score>25 && score<=30){
            grade = "A";
        }else if(score > 20 && score<=25){
            grade = "B"
        }else if(score > 15 && score <=20){
            grade = "C"
        }else if(score > 10 && score <= 15){
            grade = "D"
        }else if(score > 5 && score <= 10){
            grade = "E"
        }else {
            grade = "F"
        }
        
        return grade;
    }
    
  • + 0 comments
    function getGrade(score) {
        let grade;
        // Write your code here
        if (score <= 5) {
            grade = "F";
        } else if (score <= 10) {
            grade = "E";
        } else if (score <= 15) {
            grade = "D";
        } else if (score <= 20) {
            grade = "C";
        } else if (score <= 25) {
            grade = "B";
        } else {
            grade = "A";
        }
        
        return grade;
    }
    
  • + 1 comment

    string index

    • function getGrade(score) {
    • let grade;
    • // Write your code here
    • return "FEDCBA"[~~((score - 1) / 5)];
    • }
  • + 0 comments

    One line with lambda & string index[]:

    var getGrade = score => "FEDCBA"[~~((score - 1) / 5)];
    
  • + 1 comment

    As a Brazilian philosopher called Monark would say and been banned to the USA after "Eu sou mais louco que todos vocês." Or in English: "I am crazier than all of you.". So here's my code: