Skip to content

Commit b6d5ad8

Browse files
authored
Update js codes.docx
1 parent 0c8e378 commit b6d5ad8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎js codes.docx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,7 +2783,7 @@ const myproto = myProtoType("priya")
27832783
console.log(myproto);
27842784
console.log(myproto.getName());
27852785
==========================================================================================================================================================================
2786-
Set: It contains only unique values.
2786+
Set: It contains only unique values. Can iterate.
27872787
let arr =[1,2,3]
27882788
let obj = new Set(arr) //set takesarray, string, object etc
27892789
obj.add(4)
@@ -2794,11 +2794,12 @@ var obj1={name:"priya"}
27942794
obj.add(obj1)
27952795
console.log(obj)
27962796
======================================================================================================================================================================
2797-
Map: store in key value pair
2797+
Map: store in key value pair. Can iterate.
27982798
let myMap = new Map([["a1", "priya"],["a2","riya"]])
27992799
myMap.set("a2","supriya")
28002800
console.log(myMap.get("a2"))// will get last value which we will assign
28012801
for(let [key,value] of myMap){
28022802
console.log(`keys ${key}, value ${value}`)
28032803
}
28042804
=======================================================================================================================================================================
2805+
WeakSet: only store object, can't iterate

0 commit comments

Comments
 (0)