In Unity, there is no such as 2D rendering. Transforms will always have three component Vectors, and Quaternions which support representations of three-dimensional rotations. If your camera is set to perspective, then you can simply move the camera along the z-axis to zoom in/out. If your camera is orthographic, then you can just change the
orthographicSize of you your camera.
The reality that 2D doesn't really exist in Unity from a rendering POV, is the same case for most low-level 2D APIs that I know of. If you're converting your code to JS and using webGL 3D, then you'll still be passing 4x4 matrices through the rendering pipeline (last column and row are for translations) even if your game logic is all in 2D. Then the same strategies that I outlined above, which depend on whether your camera is perspectived' or orthographic, will work.
If you're using webGL 2D, then just use a normal scale matrix, and multiply it with your perspective, rotation and translation matrices to get your final camera matrix.
scale & 0 \\
0 & scale
Order of matrix multiplications
I realize that one of the things you might be struggling with, is the order of matrix multiplications. It seems you understand that a scale-matrix is needed, but in order for a scale to have the visual effect of zooming the scaling has to be done from the camera view's center. This means that before you apply the scale-matrix/zoom, you have to first get all the sprites into camera-space (with the camera at (0,0), pointing directly forward).
Otherwise a scale matrix will have the visual effect of making sprites look like they're getting bigger/smaller from some arbitrary anchor point. Or it'll look like you're zooming and panning the camera in an unpredictable and uncontrollable manner.
These are fundamental graphics programming topics though, so you'll be able to find really great tutorials out there online.