<div>
Article XXXXXXXXXX
<br /><br />
claps: <span id="claps"></span>
<br /><br />
<button onclick="clapButtonClicked()">Clap With Arrow Function!</button>
<button onclick="clap2ButtonClicked()">Clap Using the Regular Notation!</button>
</div>
const article = {
claps: 0,
clap: () => {
this.claps++;
},
clap2: function() {
this.claps++
}
};
function clapButtonClicked() {
article.clap();
document.getElementById("claps").innerText = article.claps;
}
function clap2ButtonClicked() {
article.clap2();
document.getElementById("claps").innerText = article.claps;
}
document.getElementById("claps").innerText = article.claps;
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.