We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
go version go1.13.3 darwin/amd64
Yes
go env
GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/Users/adam/Library/Caches/go-build" GOENV="/Users/adam/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/adam/Projects/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/adam/Projects/go/src/github.com/advanderveer/9d587b277/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8g/sd7s1zr94f948ds6_q0v3q180000gn/T/go-build209901922=/tmp/go-build -gno-record-gcc-switches -fno-common"
I want to delete an js object property
js.Global().Del("foo")
As far as i can tell there is no way to delete a property from a JS object, i tried setting it to nil or undefined but the key is still present:
js.Global().Set("__c", "foo") js.Global().Set("__c", nil) js.Global().Set("__c", js.Undefined()) println(js.Global().Call("hasOwnProperty", "__c").Bool()) //will be true
The text was updated successfully, but these errors were encountered:
This is a duplicate of #33079 and is included at tip (go1.14): https://tip.golang.org/pkg/syscall/js/#Value.Delete.
Sorry, something went wrong.
Thanks @tmthrgd. Closing since it's already fixed.
No branches or pull requests
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I want to delete an js object property
What did you expect to see?
What did you see instead?
As far as i can tell there is no way to delete a property from a JS object, i tried setting it to nil or undefined but the key is still present:
The text was updated successfully, but these errors were encountered: