Prototype - remove() 方法
此方法从哈希中删除键并返回其值。此方法自 v1.6.0 起不可用。
语法
hash.remove(key1, key2...);
返回值
返回合并后的哈希。
示例
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function showResult() { var h = new Hash({ a:'apple', b:'banana', c:'coconut' }); alert("Before removing elements : " + h.inspect() ); // 删除两个元素。 h.remove('a', 'c'); alert("After removing elements : " + h.inspect() ); } </script> </head> <body> <p>单击按钮查看结果。</p> <br /> <br /> <input type = "button" value = "Result" onclick = "showResult();"/> </body> </html>
输出
prototype_hash_processing.html