I am having a lot of confusion understanding why the commenting out gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT) makes no difference to the result. in both cases my textues cube is drawn and rotated as expected. The only time this makes a difference is when I am drawing to a framebuffer. Can someone shed some light on this please?

	gl.drawElements(gl.TRIANGLES, 36 , gl.UNSIGNED_SHORT, 0);

What do you mean? For basic OpenGL rendering, you are always rendering to a framebuffer (default framebuffer or FBO).

so my question is why commenting out gl.clear makes no difference. I would have expected the depth testing to fails as the depth buffer is not cleared before each frame. however this is not the case and the cube is renderd with no problem.
but if i rendered the same cube to a framebuffer before using the colour attachment as texture for a quad then I have a problem without gl.clear. I’m just finding that behaviour very stranger.