Skip to content

Commit

Permalink
fix: weird index zero issue (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-azambuja authored Oct 13, 2021
1 parent 89f1b77 commit 3b2870c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const names = ['Bolsonaro','Bolsomito'],
elements = [...document.getElementsByTagName('*')],
nicknames = [
'0', // I DONT HAVE IDEA WHAT, BUT THIS FIX UNDEFINED RETURN IN getRandomNicknames func :3
'Bonoro',
'Bozonaro',
'Bozo',
Expand Down Expand Up @@ -49,7 +48,7 @@ const names = ['Bolsonaro','Bolsomito'],
'Bozoasno',
'Bostanaro',
],
getRandomPosition = array => Math.floor(Math.random() * array.length) - 0 || 7,
getRandomPosition = array => Math.floor(Math.random() * array.length),
getRandomNickname = array => array[getRandomPosition(array)],
main = () => elements.forEach((element) => { // code by @pauladiniz - https://github.com/pauladiniz/loremipsum4president <- this girl is awesome <3
let validNodes = [...element.childNodes].filter(n => n.nodeType === 3)
Expand All @@ -59,4 +58,4 @@ const names = ['Bolsonaro','Bolsomito'],
politicsSUX !== text ? node.nodeValue = politicsSUX : ''
})
})
main()
main()

0 comments on commit 3b2870c

Please sign in to comment.