Skip to content

Commit 3d1cf1b

Browse files
authored
Update js codes.docx
1 parent 5c3718e commit 3d1cf1b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

js codes.docx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ uniqueElements([1,2,3,4,4],[2,3,4,5,6])
454454
Code 33: Find first duplicate element from an array
455455
function firstDuplicate() {
456456
let arr = [1,2,2,5,5];
457-
let data = [];
457+
let data = {};
458458
for (var item of arr) {
459459
if (data[item]) {
460460
return item

0 commit comments

Comments
 (0)