BairdyB
Denoβ€’3y agoβ€’
2 replies
Bairdy

prototype dot functions. How?

How would I go about creating dot function that can be chained at the end of a number in Deno?

Example: (2).toUSD() // returns $2.00

function toUSD(amount) {
  // RETURN Something..
  return new Intl.NumberFormat("en-US", {
    style: "currency",
    currency: "USD"
  }).format(amount);
},
Was this page helpful?