알고리즘 34 - Do I get a bonus?

jabae·2021년 10월 25일
0

알고리즘

목록 보기
34/97

Q.

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 and Julia), "$" (C#, C++, Ruby, Clojure, Elixir, PHP, Python, Haskell and Lua) or "¥" (Rust).

A)

function bonusTime(salary, bonus) {
// your code here
  return bonus ? `£${salary * 10}` : `£${salary}`
}
profile
it's me!:)

0개의 댓글