Maps
A Map
is a new object type in ES6 that represents a data structure to hold a collection of key-value
pairs. A key in Map can be of any type - any primitive type, symbol, date, object or a function can be a key. Same holds for the values.
Create Map
Initialize Map with an array:
The following JSFiddle creates a Map of few commonly needed regular expression , like for phone number or email address, initialized with an array. The react component uses this map to validate values entered in email or phone fields.
Last updated