You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otto is an implementation of ECMA standard version ES5. "let" and "const"
are not part of that standard. They were introduced in ES6.
You should use "var" instead.
On Fri, 22 Dec 2023, 04:09 Ahuigo, ***@***.***> wrote:
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)
}
}
—
Reply to this email directly, view it on GitHub
<#515>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH2YHJJGJ6NK4IYEGGVF72LYKUBVRAVCNFSM6AAAAABA7JR6E6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TGMZVGI4TSMY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
I find another lib which supports
const
/let
: https://github.com/dop251/gojaThe text was updated successfully, but these errors were encountered: