Edit in JSFiddle

var btn = document.getElementsByClassName("btn");

for(var i = 0; i < btn.length; i++){
	btn[i].addEventListener("click",function(){
  	console.log(this.innerText);
    document.getElementById("command").innerText = this.innerText;
  });
}
<!-- Easy JavaScript # 36 - What is this? -->
<p>
Welcome to the 36th Easy JavaScript tutorial, part of <a href="http://www.easyprogramming.net">EasyProgramming.net</a>. Do you know what 'this' is? 
</p>
<p>
Well aside from being a keyword, and NOT a variable, 'this' refers to whatever thing that currently owns that piece of JavaScript code. If it's an object, then the object is the value of 'this' and if it's a function, 'this' is whatever object called the function.  This is very important before we dig into custom JavaScript objects.
</p>

<h2>Let's practice:</h2>
<button class="btn">Attack</button>
<button class="btn">Defend</button>
<br /><br />
You clicked on <span id="command"></span>!