Advertisement
nikolayneykov

Untitled

May 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve () {
  2.   Array.from(document.querySelectorAll('a')).forEach(a =>
  3.     a.addEventListener('click', function () {
  4.       let count = +this.nextElementSibling.textContent.match(/\d+/)[0] + 1
  5.       this.nextElementSibling.textContent = `Visited: ${count} times`
  6.     })
  7.   )
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement