https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduc
Array.prototype.reduce() - JavaScript | MDN
reduce() ๋ฉ์๋๋ ๋ฐฐ์ด์ ๊ฐ ์์์ ๋ํด ์ฃผ์ด์ง ๋ฆฌ๋์ (reducer) ํจ์๋ฅผ ์คํํ๊ณ , ํ๋์ ๊ฒฐ๊ณผ๊ฐ์ ๋ฐํํฉ๋๋ค.
developer.mozilla.org
๋ฐฐ์ด์ ๋ชจ๋ ๊ฐ ํฉ์ฐ
var total = [ 0, 1, 2, 3 ].reduce(
( accumulator, currentValue ) => accumulator + currentValue,0)
'๐ป FE > ๐ HTML & CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ HTML / CSS ] ํฌ์ง์ ๋, position (0) | 2023.12.14 |
---|---|
[ HTML / CSS ] z-index, stacking context (0) | 2023.12.14 |
[ HTML / CSS ] ๊ณต์ฉํค์๋ inherit, initial, unset (0) | 2023.12.12 |
[ HTML / CSS ] background-size ์์ฑ (auto, contain, cover) (0) | 2023.12.09 |
[ HTML / CSS ] ์ธ๋ผ์ธ ์์ & ๋ธ๋ก ์์ (0) | 2023.12.08 |