Inflearn コミュニティ Q&A
for 반복문 관련 문의
作成
·
184
0
function solution(argStrNum, argLen) {
let arrRet = [];
const combiAll = (strPre, strNum) => {
for (let idx = 0; idx < strNum.length; idx++)
// for (let idx in strNum)
{
arrRet.push(strPre + strNum[idx]);
combiAll(strPre + strNum[idx], strNum.slice(idx + 1));
}
};
combiAll("", argStrNum);
console.log(arrRet);
arrRet = arrRet.filter((x) => x.length === argLen);
console.log(arrRet);
}
const strNum = "1723";
const intLen = 2;
console.log(solution(strNum, intLen));
위 코드에서 for 반복문을 comment한 것으로 교체시 결과가 다른 이유를 모르겠습니다.
javascript코테 준비 같이 해요!
回答
回答を待っている質問です
最初の回答を残してください!





