JavaScript Map delete() method

The JavaScript map delete() method eliminates the specified element from a Map object.

Syntax:

mapObj.delete()

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var hello=new Map();
hello.set("GOOD MORNING");
hello.set("GOOD AFTERNOON");
hello.set("GOOD EVENING");
hello.set("GOOD NIGHT");
document.writeln("Number of elements: "+ hello.size+"<br>");
hello.delete("GOOD NIGHT");
document.writeln("Number of elements: "+hello.size);
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com