The WebGLRenderingContext.stencilMaskSeparate() method of the WebGL API controls enabling and disabling of front and/or back writing of individual bits in the stencil planes.
The WebGLRenderingContext.stencilMask() method can set both, the front and back stencil writemasks to one value at the same time.