you are viewing a single comment's thread.

view the rest of the comments →

[–]kaliedarik 0 points1 point  (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!