Cộng đồng Hỏi & Đáp của Inflearn
for 반복문 관련 문의
Viết
·
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코테 준비 같이 해요!
Câu trả lời
Câu hỏi này đang chờ câu trả lời
Hãy là người đầu tiên trả lời!





