Question: JSLint is not passing this as a valid code:

```
/* global someVar: false */
if (typeof someVar === "undefined") {
    var someVar = "hi!";
}

```

What is the correct way?

Answer: 
```
/**
 * @param {string} nameOfVariable
 */
function globalExists(nameOfVariable) {
    return nameOfVariable in window
}

```

It doesn't matter whether you created a global variable with var foo or window.foo — variables created with var in global context are written into window.
If you are not sure whether a global variable is defined, you can always try accessing it and see what happens.

```
function node_env(name) {
    try {
        return process.env[name];
    } catch (ignore) {}
}

```