Skip to content
New issue

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

Added important scope information #1236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/03.reference/01.functions/isnull/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,24 @@ categories:
description: Determines whether given object is null or not
---

Determines whether given object is null or not
Determines whether given object is null or not.

**IMPORTANT** — When testing the presence of `null` values unscoped variables will use scope precedence to determine if the variable exists in any scope. This behavior differs from Adobe ColdFusion. So when testing when local variables in a function are `null`, it’s important to prefix the variable with the `local` scope.

For example, in the following code the variable `name` would return `false` for the `isNull()` if `name` ends up in a user supplied scope, such as the `URL` or `FORM` scopes:

```
function getName(){
var name = nullValue();
return isNull(name) ? "is null" : "is not null";
}
```

In order to make sure that only the local `name` variable is checked, you would change the code to:

```
function getName(){
var name = nullValue();
return isNull(local.name) ? "is null" : "is not null";
}
```