-
Notifications
You must be signed in to change notification settings - Fork 600
Open
Labels
Description
package m
import (
"fmt"
"testing"
"github.com/robertkrimen/otto"
)
func TestEvalJs(t *testing.T) {
vm := otto.New()
vm.Set("body", `{"page":1}`)
v, err := vm.Run(`
let abc = 2 + 2;// Not work here
console.log("The value of abc is " + abc); // 4
`)
if err != nil {
fmt.Printf("%+v, val:%v", err, v)
}
}
I find another lib which supports const/let: https://github.com/dop251/goja