Home | Mailing List | Blog | Tutorial Videos

Map letters to numbers

Consider the following mapping. What gets logged?

const myArr = ['a', 'b', 'c'];
const myMap = { a: 1, b: 2, c: 3 };

const result = myArr.map(letter => myMap[letter]);
console.log(result);

Select one: