/
Phone API Reference - Extended - util.isDef

Phone API Reference - Extended - util.isDef

Desk Phone API features described in this section are deprecated and supported only on the following models: D40, d45, d50, d60, d62, d65, d70

util.isDef

Description

Returns true if the supplied variable is defined, false if it is not defined (undefined).

Basic Example: 

util.isDef(var);

Note: if the variable you are testing has not been declared in anyway, this will throw an exception. If it has been declared but iniitalized as undefined (e.g., not set in any way), the code will process.

Parameters

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

var

Yes

variable

 

Variable to be checked for definition.

 

Examples

util.isDef returns true or false

var declaredUndef; var str = 'foo'; var obj = {'test1' : 'abc'}; util.isDef(str);    // returns true util.isDef(obj.test1);  // returns true util.isDef(obj.test2);  // returns false util.isDef(declaredUndef); // false util.isDef(nonDeclaredVariable); // throws exception

Related content

Phone API Reference - Extended - util.isUndef
Phone API Reference - Extended - util.isUndef
More like this
Phone API Reference - Extended - app.checkRequired
Phone API Reference - Extended - app.checkRequired
More like this
Phone API Reference - Extended - util.debug
Phone API Reference - Extended - util.debug
More like this
Phone API Reference - Extended - util
Phone API Reference - Extended - util
More like this
Phone API Reference - Extended Classes
Phone API Reference - Extended Classes
More like this
Phone API Reference - Extended - util.forceArray
Phone API Reference - Extended - util.forceArray
More like this

Return to Documentation Home I Return to Sangoma Support