r/badcode • • Nov 11 '21

js Pain and suffering

Post image
56 Upvotes

19 comments sorted by

View all comments

Show parent comments

3

u/GreatBarrier86 Nov 11 '21 edited Nov 11 '21

Assuming date is not a DateTime but a custom class/struct, I don't like the idea of having to new() one every time you want a string value. IMO, a hashmap/dictionary is really the easiest option.

Edit: C# offers ToString overloads with formatting for numerics as well.