JavaScript weakSet delete() Method Last Updated : 11 Jul, 2025 Suggest changes Share Like Article Like Report JavaScript weakSet.delete() method is used to delete a specific element from a weakSet object. The WeakSet object lets you store weakly held objects in a collection. Syntax: weakSet.delete(value); Parameters: This method accepts a single parameter value. value: This value will be deleted from the weakset object. Return Values: It returns true if the element has been removed successfully from the weakset object and false if the element has not been removed successfully or the element is not found in the weakset. Below are examples of weakSet.delete() method: Example 1: javascript function gfg() { const A = new WeakSet(); const B = {}; A.delete(B); console.log(A.has(B)); } gfg(); Output: false Example 2: Here output is true at first which means that element "B" has been set into the weakSet object successfully and after it is false it says that the element "B" has been deleted successfully from the weakSet object. javascript // Constructing weakSet() object const A = new WeakSet(); // Creating a new element const B = {}; // Adding the element to the weakset object A.add(B); // Testing whether the element has been // set into the weakset object or not console.log(A.has(B)); // Deleting B form the weakSet() object A.delete(B); // Testing whether the element "B" has been deleted or not console.log(A.has(B)); Output: true false Supported Browsers: Google Chrome 36 and aboveFirefox 34 and aboveApple Safari 9 and aboveOpera 23 and aboveEdge 12 and above We have a complete list of Javascript weakSet methods, to check those please go through this JavaScript WeakSet Complete Reference article. S ShivamKD Follow Article Tags : JavaScript Web Technologies JavaScript-WeakSet JavaScript-Methods Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)9 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like