Programming/JavaScript
Coding Challenge #4 - tip calculator using ternary operator
sunny.ryu
2022. 8. 30. 22:00
const billValue = 430;
const tip = billValue >= 50 && billValue <= 300 ? billValue * 0.15 : billValue * 0.2;
console.log(`The bill was ${billValue}, the tip was ${tip}, and the total value ${billValue + tip}`);
// billValue = 275, prints The bill was 275, the tip was 41.25, and the total value 316.25
// billValue = 40, prints The bill was 40, the tip was 8, and the total value 48
// billValue = 430, prints The bill was 430, the tip was 86, and the total value 516
const tip 마지막에 세미 콜론 자꾸 빼먹네 ;;
크거나 같다에서 쵸큼 헤맴