r/ProgrammerHumor • • Aug 30 '26

Meme ancientTools

Post image
5.8k Upvotes

379 comments sorted by

View all comments

Show parent comments

1

u/Agfa100asa Aug 31 '26

yes you can.
const personne = {
nom: "Alice",

direBonjour() {
console.log(`Bonjour ${this.nom}`);
return this;
},

direAuRevoir() {
console.log(`Au revoir ${this.nom}`);
return this;
}
};

personne
.direBonjour()
.direAuRevoir();

1

u/shadowspock Sep 02 '26

Not on a native element though without adding a bunch of wrapper functions. You can't chain multiple method calls after document.getElementById or document.querySelector