JSFiddle - React, Tailwind, and code Playground
JavaScript
// By attaching `t` to the prototype
function Speak1() {}
Speak1.prototype.t = 5;
// By attaching `t` to the newly created object
function Speak2() {
this.t = 5;
}
// By returning an object containing `t` (thus overriding the formerly allocated this)
function Speak3() {
return {
t: 5
};
}
console.log( (new Speak1()).t );
console.log( (new Speak2()).t );
console.log( (new Speak3()).t );