I have a function that can be passed a complete function.
I don't want to invoke complete if it is not null so I do

```
function queryJS(sql, success, error, complete) { 
...
...
if (complete !== null) complete()
...
...

```

When I invoke the function with 3 params such as:

```
queryJS("SELECT BLAH FROM TABLE", mysuccess, myerror) 

```

I get:

```
TypeError: complete is not a function

```

What are my doing wrong?

And what is the best way to cover the case of no complete function passed.

Thanks