
- Prototype 教程
- Prototype - 首頁
- Prototype - 簡要概述
- Prototype - 實用功能
- Prototype - 實用方法
- Prototype - 元素物件
- Prototype - 處理數字
- Prototype - 處理字串
- Prototype - 處理陣列
- Prototype - 處理雜湊
- Prototype - 基礎物件
- Prototype - 模板化
- Prototype - 列舉
- Prototype - 事件處理
- Prototype - 表單管理
- Prototype - JSON 支援
- Prototype - AJAX 支援
- Prototype - 表達範圍
- Prototype - 週期性執行
- Prototype 實用資源
- Prototype - 速查指南
- Prototype - 實用資源
- Prototype - 討論
原型 - unset() 方法
此方法刪除雜湊鍵的屬性並返回其值。如果在雜湊中沒有找到該鍵,則無所操作並返回 undefined。
語法
hash.unset(key);
返回值
返回已刪除鍵的值。
示例
<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' }); // Returns 'apple' alert( "h.unset('a') : " + h.unset('a') ); } </script> </head> <body> <p>Click the button to see the result.</p> <br /> <br /> <input type = "button" value = "Result" onclick = "showResult();"/> </body> </html>
輸出
prototype_hash_processing.htm
廣告