Think of the Date() object:
thisDate = new Date()
thatDate = new Date()
thisDate - thatDate //returns some date object
Would it be possible for me to make some object, say Clovers()
such that:
theseClovers = new Clovers();
theseClovers.count = 10;
thoseClovers = new Clovers();
thoseClovers.count = 4;
theseClovers - thoseClovers; //returns b = new Clovers(); b.count = 6
This is the way I envisage it (but is entirely hypothetical):
function Clovers(){
onSubtract(b){
if(b instanceOf someClass){
return this.count - b.count
}
}
}