function getContext(canvas, opt_attribs) {
    var gl = createContext(canvas, opt_attribs);
    addVertexArrayObjectSupport(gl);
    return gl;
  }
Gets a WebGL context.  Will create a WebGL2 context if possible.

You can check if it's WebGL2 with

   function isWebGL2(gl) {
     return gl.getParameter(gl.VERSION).indexOf("WebGL 2.0 ") == 0;
   }

@param {HTMLCanvasElement} canvas a canvas element.
@param {WebGLContextCreationAttirbutes} [opt_attribs] optional webgl context creation attributes
@return {WebGLRenderingContext} The created context.
@memberOf module:twgl