原型 - 可列舉 member() 方法
此方法確定給定物件是否在可列舉或不在可列舉(基於 == 比較運算子)。這是 include() 的便利別名。
語法
Iterator.member(object);
返回值
如果找到給定物件,則返回 true 值,否則返回 false。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
alert("$R(1,15).member(10) : " + $R(1,15).member(10) );
// Returns true.
}
</script>
</head>
<body>
<p>Click the button to see the result.</p>
<br />
<br />
<input type = "button" value = "Result" onclick = "showResult();"/>
</body>
</html>
輸出
prototype_enumerating.htm
廣告