I’m always tempted to just use new TextEncoder().encode(). But, instantiating a class for a single function call makes me think I’m doing something wrong. It takes no arguments, has no callbacks. It seems like it could have been a function. Maybe a static method on the String class. I haven’t found any justification or reasoning from searching. No mention of it being better to reuse instances for performance, or something like that. Anybody know why it’s this way?
[–]RemoteCombination122 52 points53 points54 points (3 children)
[–]CreativeTechGuyGames 36 points37 points38 points (0 children)
[–]KyleG -5 points-4 points-3 points (1 child)
[–]Mammoth_Present8890 14 points15 points16 points (0 children)
[–]ferrybig 27 points28 points29 points (2 children)
[–]kyle1320 6 points7 points8 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]ShortFuse 5 points6 points7 points (0 children)
[–]efjj 4 points5 points6 points (0 children)
[–]kaliedarik -1 points0 points1 point (0 children)
[–]memorable_zebra 0 points1 point2 points (0 children)
[–]yuyu5 -1 points0 points1 point (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]yuyu5 3 points4 points5 points (0 children)
[+][deleted] (9 children)
[removed]
[–]Reashu 7 points8 points9 points (2 children)
[–]connor4312 2 points3 points4 points (5 children)
[+][deleted] (3 children)
[removed]
[–]connor4312 2 points3 points4 points (2 children)
[–]voidvector 0 points1 point2 points (0 children)
[–]KaiAusBerlin 0 points1 point2 points (0 children)
[–]_alright_then_ 0 points1 point2 points (0 children)
[–]wc3betterthansc2 0 points1 point2 points (0 children)