TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

JavaScript WeakMap

JavaScript WeakMap with example, clear() method, javascript weakmap methods, javascript weakmap set() method, javascript weakmap delete() method, javascript weakmap has() method, javascript weakmap get() method etc.

<< Back to JAVASCRIPT

JavaScript WeakMap Object

The JavaScript WeakMap object is a type of collection which is almost similar to Map. It stores each element as a key-value pair where keys are weakly referenced. Here, the keys are objects and the values are arbitrary values.

Syntax

new WeakMap([iterable])

Parameter

iterable - It represents an array and other iterable object whose elements are in the form of key-value pair.

Points to remember

  • A WeakMap object allows the keys of object type only.
  • In WeakMap, if there is no reference to a key object, they are targeted to garbage collection.
  • In WeakMap, the keys are not enumerable. So, it doesn't provide any method to get the list of keys.
  • A WeakMap object iterates its elements in insertion order.

JavaScript WeakMap Methods

Methods Description
delete() It deletes the specified element from the WeakMap object.
get() It returns the value of specified key.
has() It indicates whether the WeakMap object contains the specified value element.
set() It adds or updates the key-value pairs to WeakMap object.





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf