Creating a new Map

suggest change

Maps can be created in multiple ways.

Using the constructor, you can create a new map as follow:

var searchTerms = new Map();

Types for the key and value can also be defined using generics:

var nobleGases = new Map<int, String>();
var nobleGases = <int, String>{};

Maps can otherwise be created using the map literal:

var map = {
    "key1": "value1",
    "key2": "value2"

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents