Entry
How do I use the method contains?
How do I use the method contains?
Apr 15th, 2005 02:52
Martin Honnen,
The method contains takes one argument, the value to check for, and then
returns true if there is (at least) one XML object in the list that
compares equal to the value, otherwise false is returned.
Here are some examples:
var xmlList = <>
<god>Kibo</god>
<god>Xibo</god>
</>;
alert(xmlList.contains(<god>Kibo</god>)); // shows 'true'
alert(xmlList.contains(<god>Maho</god>)); // shows 'false'
alert(xmlList.contains('Kibo'));
// shows 'true' as <god>Kibo</god> == 'Kibo' yields true