- JavaScript:Moving to ES2015
- Ved Antani Simon Timms Narayan Prusty
- 80字
- 2021-07-09 19:07:35
Maps
ECMAScript 6 introduces maps. A map is a simple key-value map and can iterate its elements in the order of their insertion. The following snippet shows some methods of the Map
type and their usage:
var founders = new Map(); founders.set("facebook", "mark"); founders.set("google", "larry"); founders.size; // 2 founders.get("twitter"); // undefined founders.has("yahoo"); // false for (var [key, value] of founders) { console.log(key + " founded by " + value); } // "facebook founded by mark" // "google founded by larry"
推薦閱讀
- OpenStack Cloud Computing Cookbook(Third Edition)
- 復雜軟件設計之道:領域驅動設計全面解析與實戰
- Moodle Administration Essentials
- Dependency Injection in .NET Core 2.0
- Visual C
- Android底層接口與驅動開發技術詳解
- C語言課程設計
- Extending Puppet(Second Edition)
- 快速入門與進階:Creo 4·0全實例精講
- Raspberry Pi Robotic Blueprints
- C++ Fundamentals
- 網絡數據采集技術:Java網絡爬蟲實戰
- Machine Learning for Developers
- ASP.NET 4.0 Web程序設計
- Python+Office:輕松實現Python辦公自動化