Skip to content

let x=1 and const x=1 don't work. #515

Description

@ahuigo
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions