나는 이렇게 학습한다/Algorithm & SQL

0108. How many lightsabers do you own?

daco2020 2023. 1. 9. 01:02
반응형

Inspired by the development team at Vooza, write the function that

  • accepts the name of a programmer, and
  • returns the number of lightsabers owned by that person.

The only person who owns lightsabers is Zach, by the way. He owns 18, which is an awesome number of lightsabers. Anyone else owns 0.

Note: your function should have a default parameter.

For example(Input --> Output):

"anyone else" --> 0
"Zach" --> 18



Solution:

let howManyLightsabersDoYouOwn = (name) => (name == 'Zach') ? 18 : 0


반응형