for (var i = 0; i < div.children.length; i++) {
p[i].onclick = function(e) {
console.log(e.target.parentNode.removeChild(e.target));
};
}
for (var i = 0; i < div.children.length; i++) {
p[i].onclick = function() {
console.log(this.parentNode.removeChild(this));
};
}
function removeNode (node) {
return node.parentNode.removeChilde(node);
}
for (var i = 0; i < div.children.length; i++) {
p[i].onclick = function (event) {
console.log(removeNode(event.target));
};
}