var letterCombinations = function(digits) {
const dic = { "2":"abc", "3":"def", "4":"ghi", "5":"jkl", "6":"mno", "7":"pqrs", "8":"tuv", "9":"wxyz"}
const result = [];
if(digits.length === 0) return [];
const dfs = (index, path) => {
if(index === digits.length){
result.push(path);
return;
}
let word = dic[digits[index]];
for(let j = 0; j < word.length; j++){
dfs(index + 1, path + word[j]);
}
}
dfs(0, '');
return result;
};