JS10 Day 2: Conditional Statements: If-Else

1 개요[ | ]

Day 2: Conditional Statements: If-Else
해커랭크 10 Days of Javascript
# 문제 비고
2-3 Day e
6 JS10 Day 2: Conditional Statements: If-Else
7 JS10 Day 2: Conditional Statements: Switch
8 JS10 Day 2: Loops
9 JS10 Day 3: Arrays
10 JS10 Day 3: Try, Catch, and Finally
11 JS10 Day 3: Throw

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    
    main();    
});

function readLine() {
    return inputString[currentLine++];
}
function getGrade(score) {
    if( 25 < score ) return 'A';
    if( 20 < score ) return 'B';
    if( 15 < score ) return 'C';
    if( 10 < score ) return 'D';
    if( 5 < score ) return 'E';
    return 'F';
}
function main() {
    const score = +(readLine());
    
    console.log(getGrade(score));
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}