https://www.codewars.com/kata/56f6ad906b88de513f000d96
Codewars - Achieve mastery through coding practice and developer mentorship
A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!
www.codewars.com
DESCRIPTION:
It's bonus time in the big city! The fatcats are rubbing their paws in anticipation... but who is going to make the most money?
Build a function that takes in two arguments (salary, bonus). Salary will be an integer, and bonus a boolean.
If bonus is true, the salary should be multiplied by 10. If bonus is false, the fatcat did not make enough money and must receive only his stated salary.
Return the total figure the individual will receive as a string prefixed with "£" (= "\u00A3", JS, Go, Java, Scala, and Julia), "$" (C#, C++, Ruby, Clojure, Elixir, PHP, Python, Haskell, and Lua) or "¥" (Rust).
코드
function bonusTime(salary, bonus) {
return bonus ? '£' + salary * 10 : '£' + salary;
}
'알고리즘 > Codewars' 카테고리의 다른 글
[Codewars] Count the Monkeys! (8 kyu) / JavaScript (0) | 2023.02.18 |
---|---|
[Codewars] Remove the minimum (7 kyu) / JavaScript (0) | 2023.02.17 |
[Codewars] Which are in? (6 kyu) / JavaScript (0) | 2023.02.15 |
[Codewars] Break camelCase (6 kyu) / JavaScript (0) | 2023.02.14 |
[Codewars] Grasshopper - Grade book (8 kyu) / JavaScript (0) | 2023.02.13 |
댓글