Skip to content

Commit 043300f

Browse files
committed
Small fixes
1 parent bb9be28 commit 043300f

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎Sprint-2/implement/contains.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function contains(toCheck, input) {
77
return false;
88
}
99

10-
for (const i in toCheck) {
11-
if (i === input) {
10+
for (const key in toCheck) {
11+
if (key === input) {
1212
return true;
1313
}
1414
}

‎Sprint-2/implement/lookup.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ function createLookup(array) {
1010
}
1111

1212
let output = {};
13-
for (const i of array) {
14-
const key = i[0];
15-
const value = i[1];
13+
for (const pair of array) {
14+
const key = pair[0];
15+
const value = pair[1];
1616

1717
output[key] = value;
1818
}

‎Sprint-2/implement/querystring.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ function parseQueryString(queryString) {
2121
const value = decodeURIComponent(parts.slice(1).join("="));
2222

2323
// if no key then assign new value
24-
if (!(key in queryParams)) {
24+
if (!Object.hasOwn(queryParams, key)) {
2525
queryParams[key] = value;
26-
// if array then push a new value to it
2726
} else if (Array.isArray(queryParams[key])) {
2827
queryParams[key].push(value);
2928
// if not array then turn into array with old and new values

0 commit comments

Comments
 (0)