Q:

Why does content of h1 tag doesnot change after clicking reset button?

var one = document.getElementById("one");
var two = document.getElementById("two");
var reset = document.getElementById("reset");
var i = 0;
var j = 0;
one.addEventListener("click", function() {
  i = i + 1;
  document.querySelector("#d1").textContent = i;
});
two.addEventListener("click", function() {
  j = j + 1;
  document.querySelector("#d2").textContent = j;
});
reset.addEventListener("click", function() {
  document.getElementsByTagName("h1").innerHTML = "<h1>0 to 0</h1>";
});
// it doent work when i add textcontent in place of inner html

> why does content of h1 doesnot change when i click reset button.
<!DOCTYPE html>
<html>

<head>
  <title>Score Keeper</title>
</head>

<body>
  <h1><span id="d1">0</span> to <span id="d2">0</span></h1><br>
  <p>Playing To : 5</p><br>
  <input type="number">
  <button id="one">Player One</button>
  <button id="two">Player Two</button>
  <button id="reset">Reset</button>
</body>
<script type="text/javascript" src="score.js"></script>

</html>

why does content of h1 doesnot change when i click reset button.

A:

Problem  :
document.getElementsByTagName returns an array so you will need index you could use 
document.getElementsByTagName("h1")[0].innerHTML = "<h1>0 to 0</h1>";

But a better version is this : 

var one = document.getElementById("one"),
    two = document.getElementById("two"),
     reset = document.getElementById("reset"),
     i = 0, 
     j = 0;
one.addEventListener("click", function() {
  i ++;
  document.querySelector("#d1").textContent = i;
});
two.addEventListener("click", function() {
  j ++;
  document.querySelector("#d2").textContent = j;
});
reset.addEventListener("click", function() {
  i = 0 , j = 0
  document.getElementById("resetId").innerHTML = "<span id="d1">0</span> to <span id="d2">0</span>"; // Thanks to @Micheale
});
<!DOCTYPE html>
<html>

<head>
  <title>Score Keeper</title>
</head>

<body>
  <h1 id='resetId'><span id="d1">0</span> to <span id="d2">0</span></h1><br>
  <p>Playing To : 5</p><br>
  <input type="number">
  <button id="one">Player One</button>
  <button id="two">Player Two</button>
  <button id="reset">Reset</button>
  <script type="text/javascript" src="score.js"></script>
</body>

</html>

