강의

멘토링

커뮤니티

Inflearn コミュニティ Q&A

icandoa1346 のプロフィール画像
icandoa1346

投稿した質問数

済州コーディングベースキャンプ Code Festival: JavaScript 100製

問題84 : 数字選び

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코테 준비 같이 해요!

回答

回答を待っている質問です
最初の回答を残してください!
icandoa1346 のプロフィール画像
icandoa1346

投稿した質問数

質問する