[GopherJS] null Test


In JavaScript, we test if a variable is null by:

if (event.state === null) {
  // do something
}

In GopherJS, the equivalent is:

if event.Get("state") == nil {
      // do something
}

For undefined test (if a variable is undefined), see [3].


Tested on:

  • Ubuntu Linux 16.10
  • Go 1.7.4
  • Chromium Version 55.0.2883.87 Built on Ubuntu , running on Ubuntu 16.10 (64-bit)

References:

[1]GopherJS - A compiler from Go to JavaScript (GitHub, GopherJS Playground, godoc)
[2]

javascript null test - Google search

javascript null test - DuckDuckGo search

javascript null test - Bing search

javascript null test - Yahoo search

javascript null test - Baidu search

javascript null test - Yandex search

JavaScript null check - Stack Overflow

[3][Golang] undefined Test in GopherJS