Skip to content

Commit d953407

Browse files
author
Gonzalo Diaz
committed
[BUGFIX] SonarQube: Do not call Array#push() multiple times.
Multiple consecutive calls to methods that accept multiple arguments should be combined javascript:S7778
1 parent f2cc36d commit d953407

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/hackerrank/warmup/plusMinus.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ function plusMinus(arr) {
1717
}
1818
}
1919

20-
const result = [];
21-
22-
result.push((positives / arr.length).toFixed(6));
23-
result.push((negatives / arr.length).toFixed(6));
24-
result.push((zeros / arr.length).toFixed(6));
20+
const result = [
21+
(positives / arr.length).toFixed(6),
22+
(negatives / arr.length).toFixed(6),
23+
(zeros / arr.length).toFixed(6)
24+
];
2525

2626
return result.join(`\n`);
2727
}

0 commit comments

Comments
 (0)