|
|
|
|
|
by kybernetikos
3324 days ago
|
|
The javascript equivalent would be something like Number.prototype.multiply = function({by:multiplier, adding:summand = 0}) {
return this * multiplier + summand
}
console.log((3).multiply({by: 4, adding: 5}))
But of course, javascript APIs are hardly ever written like that. I think it's interesting how the norms of your ecosystem and very small differences in ergonomics in expression make a big difference in behaviour. |
|