这篇翻译不完整。请帮忙从英语翻译这篇文章

clear()方法会移除Map对象中的所有元素。

语法规则

myMap.clear();

例子

调用clear方法

var myMap = new Map();
myMap.set("bar", "baz");
myMap.set(1, "foo");

myMap.size;       // 2
myMap.has("bar"); // true

myMap.clear();

myMap.size;       // 0
myMap.has("bar")  // false

规范

Specification Status Comment
ECMAScript 2015 (6th Edition, ECMA-262)
Map.prototype.clear
Standard Initial definition.

浏览器兼容

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 38 19.0 (19.0) 11 25 7.1
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 38 19.0 (19.0) 未实现 未实现 8

相关链接

文档标签和贡献者

此页面的贡献者: SphinxKnight, HsuanLee, youth7
最后编辑者: SphinxKnight,