const arrList2: any[] = [];
for (let i = 0; i < arrList?.length; i += 1) {
for (let j = 0; j < list.length; j += 1) {
if (arrList[i].cdNm === list[j].cdNm) {
const temp = list[j];
temp.type = arrList[i].type;
arrList2.push(temp);
}
}
}
์์ ์ค์ธ ์ฝ๋๋ฅผ ์กฐ๊ธ ๋ณํํด์๋ค.
arrList์ list์ cdNm์ ๋น๊ตํ๋ฉฐ ๊ฐ์ cdNm์ผ๋์ list ๊ฐ์ ๋ฝ๊ณ , arrList์ type์ ์ถ๊ฐํด์ค๋ค.
๊ธฐ์กด์ list object์๋ type์ด๋ผ๋ ์์ฑ์ด ์๋๋ฐ, ์ ๋ ๊ฒ temp.type = arrList[i].type ํด์ฃผ๋ฉด ์์์ ์ type ์์ฑ์ด ๋ง๋ค์ด์ง๊ณ ๊ฐ์ด ๋ค์ด๊ฐ๋ค.
'Programming > JavaScript' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[20230103 TIL] [JavaScript] hh:mm:ss ์ ๊ท์ (0) | 2023.01.04 |
---|---|
[ 20230102 TIL ] [ JavaScript ] AG-GRID ํน์ ํ ์๊น ๋ณ๊ฒฝํ๊ธฐ (getRowStyle) (0) | 2023.01.03 |
[ apexcharts ] Mixed chart (area, column) gradient ๋ฐ๋ก ์ค์ ํ๊ธฐ (0) | 2022.10.26 |
[ JavaScript ] object ์ถ๊ฐ (0) | 2022.09.30 |
[20220302 TIL] [Xplatform] ์ฝค๋ณด๋ฐ์ค์ ์ ๋ฃ๊ธฐ, ํ ๋๋ฆฌ ์ค์ (0) | 2022.03.02 |