JavaScript Code

JavaScript Set delete()

Set delete() method

Set delete() method is used to delete a value from the set.

  • mySet is a set object.
  • delete is method name.

The delete() method returns a boolean value of true, if the specified value is present and removed, or false if the specified value is not present.


1. Delete the value 'e' from the vowels set.

const vowels = new Set(['a', 'e', 'i', 'o', 'u']);
console.log('vowels : ' + [...vowels]);
console.log('vowels : ' + [...vowels]);

Copyright @2022