var letterCombinations = function(digits) { let zimuObj = { d2: ['a','b','c'], d3: ['d','e','f'], d4: ['g','h','i'], d5: ['j','k','l'], d6: ['m','n','o'], d7: ['p','q','r','s'], d8: ['t','u','v'], d9: ['w','x','y','z'], } let zimuArr = [] let len = digits.length for(let i = 0; i<len; i++){ zimuArr.push(zimuObj[`d${digits[i]}`]) } console.log(zimuArr) }; console.log(letterCombinations("23"))