目前學習了四種對象
1.json對象 用for in遍歷 如:for(let item in st){}//返回的是鍵也是就是屬性名。
2.數組對象用for of 遍歷時 for(let item of arr){}//返回為值。
3.Set 對象用for of 遍歷時 for(let item of arr){}//返回為可以說是鍵也可以說是值 因為他的鍵和值 是一樣的。
4.Map對象用for of 遍歷時 for(let item of arr){}//返回為鍵值對的數組。
目前學習了四種對象
1.json對象 用for in遍歷 如:for(let item in st){}//返回的是鍵也是就是屬性名。
2.數組對象用for of 遍歷時 for(let item of arr){}//返回為值。
3.Set 對象用for of 遍歷時 for(let item of arr){}//返回為可以說是鍵也可以說是值 因為他的鍵和值 是一樣的。
4.Map對象用for of 遍歷時 for(let item of arr){}//返回為鍵值對的數組。
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。