how wasm do javascript `||` logical operator

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

golang/go master build version

go version devel +0c9be48a90 Wed Jun 20 04:38:48 2018 +0000 darwin/amd64

What did you do?

i want to know how to do javascript logical operator in golang wsam , such as 100 || 0 , that return 100,

if i need to do myself function or to do above logical operator by doc:

func or(i ...js.Value) {

thank you !

The Go Programming language already contains the OR operator. Here is a quicklist of operators that you can reference:

I am worried that you have no familiarity at all with the basics of the language and I would suggest that you take the Go tour to get filled in:

I know that golang supports logical operators
I am sorry not to describe my problem
I mean, after compiling go with the latest code for go’s master, it wasn’t already supporting wasm at this time?
Then, my question is how to do JavaScript’s || logical operation at this time. Is this operation now supported? I tried to use js.New or js.Get with some code, but both failed.
Do I need to implement a JavaScript function myself?

From the document:, the logic operation of JavaScript and golang is still different.

I’m sorry, did not get that from your first post but thanks for the clarification. From what I gather with wasm using Go, you just write your valid Go code and then compile to web assembly.

Check out this article, under the Generating Wasm heading:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.