Skip to content

Commit

Permalink
usar-extructura-Set
Browse files Browse the repository at this point in the history
  • Loading branch information
fernargdev committed Dec 13, 2023
1 parent 36d370b commit 689d3a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions retos/reto-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// 3 - retorno el que de true

function findFirstRepeated(gifts) {
const obj = {}
const set = new Set()

for (const gift of gifts) {
if (obj[gift]) {
if (set.has(gift)) {
return gift
}

obj[gift] = true
set.add(gift)
}

return -1
Expand Down
Empty file added retos/reto-2.jsx
Empty file.

0 comments on commit 689d3a8

Please sign in to comment.