HTMLCanvasElement: getContext() method - Web APIs | MDN

The HTMLCanvasElement.getContext() method returns a drawing context on the canvas, or null if the context identifier is not supported, or the canvas has already been set to a different context mode.