// Get the document object from the JavaScript window object doc := js.Global().Get("document") // Call the alert method on the document object doc.Call("alert", "Hello, world!")
// Get the canvas object from the document canvas := js.Global().Get("document").Call("getElementById", "myCanvas") // Call the getContext method on the canvas object ctx := canvas.Call("getContext", "2d")This code retrieves a canvas element with the ID "myCanvas" from the `document` object and then calls the `getContext` method on it to get a 2D rendering context. This can be used to draw on the canvas. Overall, the `js` package in GopherJS provides a way to interact with the JavaScript DOM API from Go code.