[thelist] JS Boolean Object...

Sam-I-Am sam at sam-i-am.com
Thu Dec 4 16:11:09 CST 2003


> bolValue = someFunc ( someVar );
> 
> if ( bolValue )  // true
>     // do something here
> else
>     alert ( bolValue.err );

is there a prototypable Boolean object in javascript? News to me if so. 
But either way, I think if someFunc returns any non zero or non-null 
value, your test
	if(bolValue)
will always evaluate to true.
Now you might be able to return an object with a value and err property, 
  to test like so:
	if( bol.value )

I don't know if this helps.. It sounds like you want a feature to be 
there that just isn't, but I'd be more than happy to be proved wrong.

Sam



More information about the thelist mailing list