What is the equivalent of using in javascript?

What would this look like in javascript? Is it the same same as import?

   using (MemoryStream byteStream = new MemoryStream())
        using (BinaryWriter stream = new BinaryWriter(byteStream))
            // stuff

No, in this case using is not the same as import. It’s RAII statement, i.e. at the end of using section the resources are released.

You probably can rewrite it without using (if we ignore exception safety; in C#):

MemoryStream byteStream = new MemoryStream();
BinaryWriter stream = new BinaryWriter(byteStream);