这篇翻译不完整。请帮忙从英语翻译这篇文章。
delete()
删除Map实例key指定的值。
Syntax 语法
myMap.delete(key);
Parameters 参数
- key
- Required. The key of the element to remove from the
Map
object.
Return value
Returns true
if an element in the Map
object existed and has been removed, or false
if the element does not exist.
Examples
Using the delete
method
var myMap = new Map(); myMap.set("bar", "foo"); myMap.delete("bar"); // Returns true. Successfully removed. myMap.has("bar"); // Returns false. The "bar" element is no longer present.
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Map.prototype.delete |
Standard | Initial definition. |
ECMAScript 2017 Draft (ECMA-262) Map.prototype.delete |
Draft |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 38 | 13.0 (13.0) | 11 | 25 | 7.1 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 未实现 | 38 | 13.0 (13.0) | 未实现 | 未实现 | 8 |