Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. mostVotes = () => {
  2. let mostVotes = 0
  3. let current = 0
  4. this.state.anecdotes.forEach((item) => {
  5. if (item.votes > this.state.anecdotes[mostVotes].votes) {
  6. mostVotes = current
  7. }
  8. current += 1
  9. })
  10. return mostVotes
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement