How can I remove Child2 by parent using js

I was going to remove Child2 by parent, but its doesn’t work

var y = document.getElementById('parent'); y.childNodes[0].removeChild(y.childNodes[0].childNodes[2]);  <div id="parent">     <div>         <a href="#">First</a>         <a href="#">second</a>         <a href="#">third</a> <!--I wanna delete this-->     </div> </div> 

Its just doesn’t delete anything