![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set.delete() function in JavaScript
The delete() function of the Set object accepts a value and removes it from the current Set object.
Syntax
Its Syntax is as follows
setObj.delete()
Example
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> const setObj = new Set(); setObj.add('Java'); setObj.add('JavaFX'); setObj.add('JavaScript'); setObj.add('HBase'); document.write("Contents of the Set before deletion:"); document.write("<br>"); for (let item of setObj) { document.write(item); document.write("<br>"); } setObj.delete('JavaFX'); document.write("Contents of the Set after deletion:"); document.write("<br>"); for (let item of setObj) { document.write(item); document.write("<br>"); } </script> </body> </html>
Output
Contents of the Set before deletion: Java JavaFX JavaScript HBase Contents of the Set after deletion: Java JavaScript HBase
Advertisements