We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Alternative solution that doesn't use any if statements! :P
functiongetGrade(score){letgrade;// Write your code hereletconvertScoreToSingleDigits=Math.floor(Math.abs(score-1)/5);letreverseDigitOrder=Math.abs(convertScoreToSingleDigits-5);letaddToCharRange=reverseDigitOrder+65;grade=String.fromCharCode(addToCharRange);returngrade;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Conditional Statements: If-Else
You are viewing a single comment's thread. Return to all comments →
Alternative solution that doesn't use any if statements! :P