//In JavaScript, the thing called this, is the object that "owns" the current code.
//The value of this, when used in a function, is the object that "owns" the function.
//working code
var i = 0;
for(i = 0; i < data.length; i++) {
btn[i].addEventListener("click", function(){
alert(this.id);
});
}