Differences between and when to use Map vs Record

Record is defined as

type Record<K extends keyof any, T> = {
    [P in K]: T;
}

While Map is a native JS ES6 data structure. Record is merely a representative way of saying, “this object is going to be used a key, value map of a specific data type”. It’s a plain object created using {}. The Map object on the other hands has some unique characteristics described here and needs to be instantiated as new Map()

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)