-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
do-i-get-a-bonus.js
49 lines (41 loc) · 1.07 KB
/
do-i-get-a-bonus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function bonusTime(salary, bonus) {
if (bonus) {
return '£' + (salary * 10);
}
return '£' + salary;
}
function bonusTime(salary, bonus) {
if (bonus) {
return `£${salary * 10}`;
}
return `£${salary}`;
}
function bonusTime(salary, bonus) {
return bonus ? `£${salary * 10}` : `£${salary}`;
}
function bonusTime(salary, bonus) {
return `£${bonus ? salary * 10 : salary}`;
}
function bonusTime(salary, bonus) {
return `£${salary * (bonus ? 10 : 1)}`;
}
function bonusTime(salary, bonus) {
const power = +bonus;
return `£${salary * 10 ** power}`;
}
function bonusTime(salary, bonus) {
return `£${salary}${bonus ? '0' : ''}`;
}
function bonusTime(salary, bonus) {
if (bonus) {
salary *= 10;
}
return '£' + salary;
}
console.log(bonusTime(10000, true), '£100000');
console.log(bonusTime(25000, true), '£250000');
console.log(bonusTime(10000, false), '£10000');
console.log(bonusTime(60000, false), '£60000');
console.log(bonusTime(2, true), '£20');
console.log(bonusTime(78, false), '£78');
console.log(bonusTime(67890, true), '£678900');