Example 1a

Javascript code posted
created at 04 May 20:41

Edit | Back
1
2
3
4
5
6
7
8
9
const para = document.querySelector('p');

para.addEventListener('click', updateName);

function updateName() {
  let name = prompt('Enter a new name');
  para.textContent = 'Player 1: 
' + name;
}
207 Bytes in 2 ms with coderay