์ด ๋ฐฉ์์ while๋ฃจํ์ Array.prototype.some() ๋ฐฉ๋ฒ์ ๊ฒฐํฉํ์ฌ ๋ฐฐ์ด์ ํํํfunction flatten(arr) { while (arr.some(el => Array.isArray(el))) { arr = [].concat(...arr); } return arr;}let nestedArray = [1, [2, 3], [4, [5, 6]]];let flatArray = flatten(nestedArray);console.log(flatArray);// [1, 2, 3, 4, 5, 6] Array.prototype.some():๋ฐฐ์ด ์์ ์ค ํ๋๋ผ๋ ์กฐ๊ฑด( Array.isArray(el))์ ๋ง์กฑํ๋ฉด true๋ฐํํฉ๋๋ค.์ฆ, ํ์ฌ ๋ฐฐ์ด์์ ๋ฐฐ์ด์ด ํ์ธ๋๋์ง ..