๋ฐ์ค์ ์ค์นํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ํ(underscore.js๊ฐ ์๋๋ผ ๋ฐ์ค๋ง ์๊ธฐ ๋๋ฌธ์) ๋ฐ์ค ๊ธฐ๋ฅ(_.once)์ ์ฌ์ฉํ๋ ค๊ณ ํ์ง๋ง ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋ด ์ฝ๋ ์๋จ์ const Underscore = require("underscore")
๊ฐ ์์ต๋๋ค. ํ์ง๋ง ์ฌ์ ํ, ๊ทธ๋ฆฌ๊ณ const Underscore = require("underscore.js")
๋ฅผ ์๋ํ ๋ ๋ชจ๋์ ์ฐพ์ง ๋ชปํ๋ฏ๋ก ์ ๋ฅผ ๊ฐ๋ฅด์ณ ์ฃผ์๊ฒ ์ต๋๊น?
์ ๋ JavaScript์ ์ง์ ํ ์ด๋ณด์์ ๋๋ค. ๋ถ๋ช ํ ์๋ชป๋ ๊ฒ์ ํ๋ฉด ์ฉ์ํด ์ฃผ์ญ์์ค.
์ฝ๋๋ Underscore
๋ผ๋ ์์์ ๋ฐ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ ๋นํฉ๋๋ค.
๋ด๊ฐ ์ํ๋ ๊ฒ์ const _ = require("underscore");
_
์
๋๋ค.
์ค ๊ฐ์ฌํฉ๋๋ค. ์๋ฐ์คํฌ๋ฆฝํธ๋ฅผ ๋ฐฐ์ฐ์ง ์์๊ธฐ ๋๋ฌธ์ ์ด ๋ช ๋ น์ด ์ค์ ๋ก ๋ฌด์์ ์๋ฏธํ๋์ง ์ดํดํ์ง ๋ชปํ์ง๋ง ์ด์ ์์์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค :D
์ฝ๋๋
Underscore
๋ผ๋ ์์์ ๋ฐ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ ๋นํฉ๋๋ค.
๋ด๊ฐ ์ํ๋ ๊ฒ์const _ = require("underscore");
_
์ ๋๋ค.
๋ช ์๊ฐ ๋์ ์ด๊ฒ์ ์ฐพ๊ณ ์์์ต๋๊น?
์ฝ๋๋
Underscore
๋ผ๋ ์์์ ๋ฐ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ ๋นํฉ๋๋ค.
๋ด๊ฐ ์ํ๋ ๊ฒ์const _ = require("underscore");
_
์ ๋๋ค.
๊ฐ์ฌํฉ๋๋ค. ์ด๊ฒ์ ๋ฐ์ ์์ฉ ํ๋ก๊ทธ๋จ์์ ์์ ํ ๋๋ ์๋ํฉ๋๋ค.
์ฝ๋๋
Underscore
๋ผ๋ ์์์ ๋ฐ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ ๋นํฉ๋๋ค.
๋ด๊ฐ ์ํ๋ ๊ฒ์const _ = require("underscore");
_
์ ๋๋ค.
๋ง์ด
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ฝ๋๋
Underscore
๋ผ๋ ์์์ ๋ฐ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ ๋นํฉ๋๋ค.๋ด๊ฐ ์ํ๋ ๊ฒ์
const _ = require("underscore");
_
์ ๋๋ค.