Map Lookups
Maps
π¨βπΌ We need fast lookups by user ID, and
Map is perfect for that.π¨ Open
and use the provided
users fixture:- Create
usersByIdas aMapkeyed by userid(size should be3) - Create
adminUserby reading id'u1'from the map (expected name'Ava') - Create
hasMissingUserby checking whether id'u99'exists (expectedfalse) - Export
usersById,adminUser, andhasMissingUser
π MDN - Map