Exists Method

Microsoft Office JScript

Microsoft® JScript® Exists Method  Scripting Run-Time Reference 
Version 2 

See Also                  Applies To


Description
Returns true if a specified key exists in the Dictionary object, false if it does not.
Syntax
object.Exists(key)

The Exists method syntax has these parts:

Part Description
object Required. Always the name of a Dictionary object.
key Required. Key value being searched for in the Dictionary object.

The following example illustrates the use of the Exists method:

function keyExists(k)
{
  var fso, s = "";
  d = new ActiveXObject("Scripting.Dictionary");
  d.Add("a", "Athens");
  d.Add("b", "Belgrade");
  d.Add("c", "Cairo");
  if (d.Exists(k))
    s += "Specified key exists.";
  else 
    s += "Specified key doesn't exist.";
  return(s);
}