<p>Open developer console to see output</p>
<button id="brag-button">Brag!</button>
class Family {
constructor(parents, children) {
this.parents = parents;
this.children = children;
}
brag() {
console.log(`Our family has ${this.parents} parents and ${this.children} children!`);
}
}
const family = new Family(3, 12);
family.brag();
window.addEventListener("load", () => {
document.getElementById("brag-button").addEventListener("click", family.brag);
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.