code: function compileShader(gl, src, type) {
    const shader = gl.createShader(type);
  
    gl.shaderSource(shader, src);
  
    // Compile and check status
    gl.compileShader(shader);
    if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
      // Something went wrong during compilation; get the error
      const lastError = gl.getShaderInfoLog(shader);
      console.error(`Error compiling shader '${shader}': ${lastError}`);
      gl.deleteShader(shader);
  
      return null;
    }
  
    return shader;
  }
docs: Compile a shader