Advertisement
Guest User

Untitled

a guest
May 25th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve() {
  2.     const links = document.querySelectorAll('a');
  3.     [...links].forEach(link => link.addEventListener('click', function(evt) {
  4.       const p = evt.currentTarget.nextElementSibling;
  5.       const visitedCount = +(p.textContent).match(/\d+/)[0] + 1;
  6.       p.textContent = `Visited: ${visitedCount} times`;
  7.     }));
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement