Skip to content

Commit 09dacd8

Browse files
authored
Merge pull request #782 from sir-gon/develop
[BUGFIX] SonarQube: Use `new Array()` instead of `Array()`.
2 parents b4e3444 + d333648 commit 09dacd8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/hackerrank/interview_preparation_kit/arrays/cruch_bruteforce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { logger as console } from '../../../logger.js';
88
function arrayManipulation(n, queries) {
99
const LENGTH = n + 1;
1010
const SURROGATE_VALUE = 0;
11-
const result = Array(LENGTH).fill(SURROGATE_VALUE);
11+
const result = new Array(LENGTH).fill(SURROGATE_VALUE);
1212
let maximum = 0;
1313

1414
for (const query of queries) {

src/hackerrank/interview_preparation_kit/arrays/cruch_optimized.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function arrayManipulation(n, queries) {
88
// last slot for storing accumSum result
99
const LENGTH = n + 2;
1010
const INITIAL_VALUE = 0;
11-
const result = Array(LENGTH).fill(INITIAL_VALUE);
11+
const result = new Array(LENGTH).fill(INITIAL_VALUE);
1212
let maximum = 0;
1313

1414
for (const query of queries) {

src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/sherlock_and_anagrams.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { logger as console } from '../../../logger.js';
77

88
function extraLongFactorials(n) {
9-
const rs = [...Array(n)].reduce((a, b, i) => a * BigInt(i + 1), 1n);
9+
const rs = new Array(n).fill().reduce((a, b, i) => a * BigInt(i + 1), 1n);
1010
return rs;
1111
}
1212

0 commit comments

Comments
 (0)