옷가게 할인 받기

임성은·2023년 2월 6일

나의 풀이

function solution(price) {
   let ten = price-(10/100*price);
   let fiv = price-(05/100*price);
   let two = price-(20/100*price);

    if(price>= 500000){
       return Math.trunc(two)
    }else if(price>= 300000){
        return Math.trunc(ten)
    }else if(price>= 100000){return Math.trunc(fiv)}
    else return price
}

💫느낀점

코드는 좀 길다 느꼈는데 다른 풀이도 엄청난 차이를 보인 것은 아니라서 다행이였다...
점수가 다른때 보다 후한 것 보니 문제가 난이도가 있었나?의문이다..

profile
개발자의 길에 당차게 들어서다!!

0개의 댓글