We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
isSeparated
1 parent f496072 commit a3f7620Copy full SHA for a3f7620
src/reorganizing-nested-code/index.js
@@ -1,14 +1,11 @@
1
export function payAmount(employee) {
2
let result;
3
- if (employee.isSeparated) {
4
- result = { amount: 0, reasonCode: 'SEP' };
+ if (employee.isSeparated) return { amount: 0, reasonCode: 'SEP' };
+ if (employee.isRetired) {
5
+ result = { amount: 0, reasonCode: 'RET' };
6
} else {
- if (employee.isRetired) {
7
- result = { amount: 0, reasonCode: 'RET' };
8
- } else {
9
- // potentially complicated logic to compute amount
10
- result = someFinalComputation();
11
- }
+ // potentially complicated logic to compute amount
+ result = someFinalComputation();
12
}
13
return result;
14
0 commit comments