https://github.com/airbnb/javascript
์ฌ๊ธฐ์ ์ฃผ์ํด์ผ ํ ๊ฒ๋ค๋ง ์ข ์ถ๋ ค๋ณธ๋ค.
๊ธฐ๋ณธ์ ์ผ๋ก eslint์ ๊ท์น์ ๋ฐ๋ฅด๋ฉด์ ์ธ๋ถ์ฌํญ์ด ์ถ๊ฐ๋์ด ์๋ค. https://eslint.org/docs/latest/rules/
References ์ฐธ์กฐ
var์ ์ง์ํ๋ค :var๋ function-scoped, ํจ์ ์ค์ฝํ๋ฅผ ๊ฐ์ง๋ค. (const์let์ ๋ธ๋ก ์ค์ฝํ block-scoped)
Object ๊ฐ์ฒด
- literal syntax๋ฅผ ํตํด ์๋ก์ด ๊ฐ์ฒด๋ฅผ ๋ง๋ ๋ค.
const student = {name:"name", age:20} Object.assign๋์ ์ ๊ฐ ๊ตฌ๋ฌธ spread syntax๋ฅผ ์ฌ์ฉํ์ฌ ์์ ๋ณต์ฌ๋ฅผ ํ๋ค.
Array ๋ฐฐ์ด
- ๊ฐ์ฒด์ ๋ง์ฐฌ๊ฐ์ง๋ก ๋ฆฌํฐ๋ด๋ก ๋ฐฐ์ด์ ์์ฑํ๋ค.
new Array()์ฌ์ฉ๊ธ์ง. - Iterableํ ๊ฐ์ฒด๋ฅผ ๋ฐฐ์ด๋ก ๋ณํํ ๋ ์ ๊ฐ ๊ตฌ๋ฌธ์ ์ฌ์ฉํ๋ค.
Array.from์ ๋งคํํจ์๊ฐ ์์๋ ์ฌ์ฉํ๋ค.[...foo].map(bar)๋์Array.from(foo,bar).- ์์ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๋ฉด ์ค๊ฐ์ ํ์์๋ ์์ ๋ฐฐ์ด์ ๋ง๋ค๊ฒ ๋๋ค.
Destructuring ๊ตฌ์กฐ ๋ถํด ํ ๋น
- ๊ฐ์ฒด์ ์ฌ๋ฌ ์์ฑ์ ์ ๊ทผํ๊ณ ์ฌ์ฉํด์ผ ํ ๊ฒฝ์ฐ์ ๊ตฌ์กฐ ๋ถํด ํ ๋น์ ์ฌ์ฉํ๋ค.
- ์ฌ๋ฌ ๊ฐ์ ๋ฐํํ ๋ ๋ฐฐ์ด ๊ตฌ์กฐ ๋ถํด ํ ๋น ๋์ , ๊ฐ์ฒด ๊ตฌ์กฐ ๋ถํด ํ ๋น์ ์ฌ์ฉํ๋ค.
return [one,two,three];๋์{one,two,three}๋ฅผ ๋ฐํํ๋ฉด ๋ฐํ๊ฐ์ ์์๋ฅผ ์ ๊ฒฝ์ฐ์ง ์์๋ ๋๊ณ , ํ์ ์๋ ๋ฐํ๊ฐ๊น์ง ๋ฐํ๋ฐ์ ํ์๋ ์์ด์ง๋ค.
String ๋ฌธ์์ด
- ์์ ๋ฐ์ดํ
''๋ฅผ ์ฌ์ฉํ๋ค. - ๋ฌธ์์ด์ด ๊ธธ๋๋ผ๋ ํ ์ค์ ์์ฑํ๋ค.
\์ด๋+๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ๋ฌ ์ค์ ๋๋ ์์ฑํ์ง ์๋๋ค. eval()ํจ์๋ฅผ ์ ๋ ๋ฌธ์์ด์ ์ฌ์ฉํ์ง ์๋๋ค.
Functions ํจ์
- ํจ์ ์ ์ธ์ ๋์ (์์ธํ ์ด๋ฆ์ ๊ฐ์ง๋)ํจ์ ํํ์์ ์ฌ์ฉํ๋ค.
function funcA(){...}๋์ `const funcA = function longUniqueMoreDescriptiveLexical(){...}
- ๊ธฐ๋ณธ๊ฐ์ด ์๋ ๋งค๊ฐ๋ณ์๋ ๋ง์ง๋ง์ ๋ฃ๋๋ค.
Classes ํด๋์ค
- ํด๋์ค ๋ฉ์๋๋ ๋ฉ์๋ ์ฒด์ด๋์ ์ํด
this๋ฅผ ๋ฐํ ํด๋ ๋๋ค. - ํด๋์ค ๋ฉ์๋๋ค์ ๋ฐ๋์
this๋ฅผ ์ฌ์ฉํด์ผ ํ๋ค. class-methods-use-thisthis๋ฅผ ์ฌ์ฉํ์ง ์๋ ๋ฉ์๋๋static๋ก ๋ง๋ ๋ค.