Exists Method
Exist Method helps the user to check whether or not the Key Value pair exists.
object.Exists(key)
Parameter Description
• Object, a Mandatory Parameter. This represents the name of the Dictionary Object.
• Key, a Mandatory Parameter. This represents the value of the Dictionary Object.
Example
<!DOCTYPE html>
<html>
<body>
<script language="vbscript" type="text/vbscript">
Dim d, msg ' Create some variables.
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Apple" ' Add some keys and items.
d.Add "b", "BlueTooth"
d.Add "c", "C++"
If d.Exists("c") Then
msgbox "Specified key exists."
Else
msgbox "Specified key doesn't exist."
End If
</script>
</body>
</html>
Save the file as .HTML, and upon executing the above script in IE,
it displays the following message in a message box.
Specified key exists.
No comments:
Post a Comment