Skip to content

Instantly share code, notes, and snippets.

@ethanstenis
Created July 17, 2017 16:34
Show Gist options
  • Save ethanstenis/230d37b3a75ce8176d16d49d15a48171 to your computer and use it in GitHub Desktop.
Save ethanstenis/230d37b3a75ce8176d16d49d15a48171 to your computer and use it in GitHub Desktop.
This is the solution to Codewars' KATA: Do I get a bonus?
function bonusTime(salary, bonus) {
if(bonus === true){
return '£' + salary * 10;
} else {
return '£' + salary;
}
}
@EngMeriem
Copy link

function bonusTime(salary, bonus) {
return bonus ? '£' + salary * 10 : '£' + salary;
}

@WesleyMatthee
Copy link

WesleyMatthee commented Oct 2, 2024

Thanks, I was getting an error but then I saw that I was printing and not returning. I used this to complete the kata in Python

def bonus_time(salary, bonus):
    if bonus == True:
        return f'${salary * 10}'
    else:
        return f'${salary}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment