Skip to content

Commit 3dcde81

Browse files
committed
refactor(lookup): simplify loop with array destructuring
1 parent c6e8c0c commit 3dcde81

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Sprint-2/implement/lookup.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
function createLookup(arrayOfPairs) {
77
const lookupObject = {};
88

9-
for (const pair of arrayOfPairs) {
10-
const key = pair[0];
11-
const value = pair[1];
12-
13-
// Bracket notation allows using a variable as the property name
9+
for (const [key, value] of arrayOfPairs) {
1410
lookupObject[key] = value;
1511
}
1612

0 commit comments

Comments
 (0)