Map data structure & ES6 map object – Beau teaches JavaScript



Maps are data structures that store key-value pairs. See how they work and learn about the ES6 map object.

💻 Code: http://codepen.io/beaucarnes/pen/jBjobG?editors=0012

🔗 Info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

🐦 Beau Carnes on Twitter: https://twitter.com/carnesbeau

⭐JavaScript Playlists⭐
▶JavaScript Basics: https://www.youtube.com/playlist?list=PLWKjhJtqVAbk2qRZtWSzCIN38JC_NdhW5
▶Data Structures and Algorithms: https://www.youtube.com/playlist?list=PLWKjhJtqVAbkso-IbgiiP48n-O-JQA9PJ
▶Design Patterns: https://www.youtube.com/playlist?list=PLWKjhJtqVAbnZtkAI3BqcYxKnfWn_C704
▶ES6: https://www.youtube.com/playlist?list=PLWKjhJtqVAbljtmmeS0c-CEl2LdE-eR_F
▶Clean Code: https://www.youtube.com/playlist?list=PLWKjhJtqVAbkK24EaPurzMq0-kw5U9pJh


We’re busy people who learn to code, then practice by building projects for nonprofits. Learn Full-stack JavaScript, build a portfolio, and get great references with our open source community.

Join our community at https://freecodecamp.com
Read great tech articles at https://medium.freecodecamp.com

source

This Post Has 12 Comments

  1. JorDANStew

    Watch 2x speed but we about 40-50 videos a week.

  2. anant varma

    Couldn't understand a single thing after watching it thrice. Rushing through the code without explaining anything. By far the worst explanation.

  3. grantpant2353

    Your typing speed literally makes my head spin. I don't think I can even make my fingers moves that fast. You're an android, aren't you?

  4. P Pow

    Correction @ 4:28
    map.entries() – returns keys + entries
    map.keys() – returns keys

  5. Seth Koch

    This is entirely incorrect. A map is not a javascript object. You would not, for example, be able to use a function as a key in your implementation. This is a very naive and very wrong tutorial. You should take this video down.

  6. Aleksandr Osipov

    So, the benefit of Map is that you can use key not only String or Symbol. But in your example you use Object as as collection to store key:value. It's wrong implementation. You need to use array as collection with item {key: key, value: value}

  7. Core Dump

    Maps are useful for practical programming and Competitive programming alike.

  8. Antonio Perez

    Hello, why do you make a size function (the one that returns the variable count), can't you just call the variable count directly?

    don't myObj.count and myObj.size() return the same value?

  9. Good Wish

    Very good explanation. Thank you teacher.

    There might be one issue. It is the count++ in set method.
    If we add item with existing key, it should not increment the count.

    My CA$ 0.02. 😉

  10. James Logan

    These tutorials are excellent! The length is perfect and seeing a new concept or an old one in a different context is so useful. Thanks!

  11. Rohan Gayen

    I am facing problems for using these new syntax of ES6… can't remember syntax at the time of programming… what to do?

Leave a Reply