Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created October 5, 2018 19:57
Embed
What would you like to do?
package main
import (
"fmt"
"syscall/js"
"strconv"
)
func main() {
num1 := js.Global().Get("document").
Call("querySelector", "#num1").
Get("value").
String()
i, _ := strconv.Atoi(num1)
fmt.Println(i)
num2 := js.Global().Get("document").
Call("querySelector", "#num2").
Get("value").
String()
j, _ := strconv.Atoi(num2)
js.Global().Get("document").
Call("querySelector", "#res").
Set("value", i + j)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment