Prototype-hash-remove

提供:Dev Guides
移動先:案内検索

プロトタイプ-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() );

           //Remove two elements.
            h.remove('a', 'c');
            alert("After removing elements : " + h.inspect() );
         }
      </script>
   </head>

   <body>
      <p>Click the button to see the result.</p>
      <br/>
      <br/>
      <input type = "button" value = "Result" onclick = "showResult();"/>
   </body>
</html>

出力