default-parameter-template-literals-arrow-functions
Default parameter
parameter๊ฐ undefined
์ผ ๋ ๋ค์ด๊ฐ default parameter๋ฅผ ์ฌ์ฉํ๋ค. ํจ์๋ ๊ฐ๋ฅํ๋ค.
example - default parameter๋ก ํจ์์ฌ์ฉ
ํจ์๋ ์ฌ์ฉ๊ฐ๋ฅ ํ๋ค. example - ์ธ์(argument)๊ฐ false, null , undefined ์ผ ๋
Template Literals
``์ ์ฌ์ฉํ๊ณ ํจ์๋ ๊ฐ๋ฅํ๋ค.'ใ '/
Arrow Functions
ํจ์ํํ์
์ผ๋ก๋ง ์จ์ผํ๋ค.hoisting์ด ์๋๋ค. (๋ ์๊ฒฉํด์ก๋ค.)
this๊ฐ ์๋ค. ๊ฐ์ฅ๊ฐ๊น์ด ์์ญ์ ์๋ ๊ฐ์ฒด๋ฅผ this๋ก ์ด๋ค.
arguments ํค์๋๊ฐ ์กด์ฌํ์ง ์๋๋ค.(rest parameter๋ก ๋์ฒดํ๋ค)
ํจ์ ํํ์์ ์ฌ์ฉํ์ผ๋ฉฐ, ๋งค๊ฐ๋ณ์๊ฐ 1๊ฐ์ผ๋๋ ()
๊ฐ ์์ด๋ ๋๋ฉฐ return์ด ํ์ค๋ก ํํ๊ฐ๋ฅ ํ ๊ฒฝ์ฐ {}
๋ ์์ด๋ ๋๋ค.
arguments ํค์๋๋ ์์ง๋ง ์ธ๋ถํจ์๋ ํจ์์ ์ธ์, ๋ด๋ถํจ์๋ arrow function์ ์ธ ๊ฒฝ์ฐ
this
scope chain์ ํ์ ๊ฐ์ฅ ๊ฐ๊น์ด this๋ฅผ ๋ฐ์๋ค.
const๊ฐ window์ ๋ถ์ง ์์์ console.log๊ฐ ์ฐํ์ง ์๋๋ค.
var๋ก ํ์ ๋๋ this๊ฐ window.name์ด ๋์ด์ 'ni'๊ฐ ์ฝ์์ ์ฐํ๋ค.
Last updated
Was this helpful?