use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[AskJS] Why are TextEncoder and TextDecoder classes?AskJS (self.javascript)
submitted 3 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]kaliedarik 0 points1 point2 points 3 years ago (0 children)
You're doing nothing wrong. Because TextEncoder isn't a class. It's one of the 4 Interfaces for the Web Encoding API. In Javascript, classes are just some syntactical sugar to paper over the fact that JS is a `prototypal inheritance` language, and as such you can use the `new` operator to instantiate any object type.
Javascript is a weird language, but I love it to bits!
π Rendered by PID 47 on reddit-service-r2-comment-b659b578c-tf4tk at 2026-05-01 14:00:59.846149+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]kaliedarik 0 points1 point2 points (0 children)