JavaScript Array concat() Method

The JavaScript array concat() method is used to return a new array object that contains two or more merged arrays. Syntax: array.concat (array1,array2,….) Example: <!DOCTYPE html> <html> <head> </head> <body> <script> var a1=[“GOLD”,”SILVER”,”DIAMOND”]; var a2=[“RUBY”,”PLATINUM”]; var a3=[“BRONZE”]; var sum=a1.concat(a2,a3); document.writeln(sum); </script> </body> </html>

JavaScript WeakMap

JavaScript WeakMap object is used to store the elements as key-value pairs where keys are weakly referenced. Syntax: new WeakMap([iterable]) Where: iterable is the object whose elements are in the form of a key-value pair. Note: WeakMap object can not contain the primitive type elements. It can contain only object-type elements. JavaScript WeakMap Methods: delete() … Read more

JavaScript Map

JavaScript map object is used to store the elements as key-value pair. All the operation like search, add, update, delete are done using key. Syntax: new Map([iterable]) Parameters: iterable: It represents the object whose elements are in the form of key-value pair. Note: Map object can not contain the duplicate keys but can contain duplicate … Read more

JavaScript Set

To store the elements with unique primitive values or object references, a javascript set object is used. Syntax: new Set([iterable]) Where: iterable is the object whose elements will be added to the new Set. Note: JavaScript set cannot contain duplicate elements i.e. it keeps unique elements only. JavaScript Set Methods: add() Use: To add the … Read more