🀟
Vanilla-JS
  • TRIPLE-PLUS Adout
  • Babel.JS
  • 01.Vanilla-JS
    • 01. Hello JavaScript
    • 02. λ³€μˆ˜
      • 02-1.μ§€ν‚€λ©΄ 쒋은 λ£°(더 쒋은 μŠ€νƒ€μΌμ„ μœ„ν•΄μ„œ)
      • 02-2.μˆ«μžν˜•κΏ€νŒ(μˆ˜μ‹ 쀄이기)
    • 03. μ—°μ‚°μž
    • 04. 쑰건문
    • 05. ν•¨μˆ˜
      • this의 의미 6개 총정리
      • event listener와 constructor
      • 05-1. return:λŒλ €μ£Όλ‹€
      • 05-2. ν˜• λ³€ν™˜ ν•¨μˆ˜
      • 05-3. Arrow function
    • 06. 객체
    • 07. λ°°μ—΄
      • 07-1. λ°°μ—΄ μ•ˆμ— λ°°μ—΄(2μ°¨ λ°°μ—΄)
      • 07-2. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(forEach)
      • 07-3. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(sort)
      • 07-4. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(map)
      • 07-5. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(indexOf)
      • 07-6. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(filter)
      • 07-7. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(splice, slice)
      • 07-8. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(shift, unshift, pop, push)
      • 07-9. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(concat, join)
      • 07-10. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(reduce)
      • 07-10. λ°°μ—΄λ‚΄μž₯ ν•¨μˆ˜(reduce)2
    • 08. 반볡문
    • 09. Class와 ν”„λ‘œν† νƒ€μž…
      • 09-1. ν”„λ‘œν† νƒ€μž…κ³Ό 클래슀 - μƒμ„±μž
      • 09-2. ν”„λ‘œν† νƒ€μž…κ³Ό 클래슀 - μƒμ„±μž μƒμ†ν•˜κΈ°
      • Class & Constructor & Method
      • super
      • Static Method
      • Class Getter, Setter
      • Information Hiding
      • Inheritance & Polymorphism
      • Overriding
      • Abstract Class
      • Interface
    • Math 정리
    • String 정리
    • Array정리
    • Date 정리
      • D-day κ΅¬ν•˜κΈ°
  • 02.Vanilla-JS
    • 01.μ‚Όν•­μ—°μ‚°μž
    • 02. Truthy and Falsy
    • 03. 단좕 평가 논리 계산법
    • 04. ν•¨μˆ˜ μ—…κ·Έλ ˆμ΄λ“œ (default parameter/arguments)
    • 05. 쑰건문 더 μŠ€λ§ˆνŠΈν•˜κ²Œ μ“°κΈ°
    • 06. 비ꡬ쑰화 ν• λ‹Ή (ꡬ쑰뢄해) 문법
    • 07. spread 와 rest
      • ν•¨μˆ˜ νŒŒλΌλ―Έν„°μ—μ„œμ˜ rest(params)
      • ν•¨μˆ˜ μΈμžμ—μ„œμ˜ spread
    • 08. μžλ°”μŠ€ν¬λ¦½νŠΈμ˜ Scope 에 λŒ€ν•œ 이해
    • 09. Hoisting μ΄ν•΄ν•˜κΈ°
    • 10. Native DOM 선택
  • 03.비동기 처리
    • 01. fetch, then, catch[Promise] μ΄ν•΄ν•˜κΈ°
    • 02. 직접 λ§Œλ“€μ–΄λ³΄λŠ” Promise 객체
    • 03. async/await
    • 04. Promise all, Promise.race
  • REST API μ œλŒ€λ‘œ μ•Œκ³  μ‚¬μš©ν•˜κΈ°
    • mongodb Atlas
    • mongodb Atlas(DB)에 μ ‘κ·Όν•˜λ €λ©΄
    • URL 이름짓기 κ΄€μŠ΅
    • Database에 자료 μ €μž₯ν•˜λŠ” 법
    • κ²Œμ‹œλ¬Όλ§ˆλ‹€ 번호λ₯Ό 달아 μ €μž₯ν•˜κΈ°
    • κ²Œμ‹œλ¬Όλ§ˆλ‹€ 번호λ₯Ό 달아 μ €μž₯ν•˜κΈ°2
  • JQUERY + SCRIPT μœ μš©ν•œ μ½”λ“œ 정리
  • Practice(μ‹€μŠ΅)
    • μΉ΄μš΄ν„° λ§Œλ“€κΈ°
    • reduce
    • 데이터 μžλ£Œν˜• ν™œμš©ν•˜κΈ°1
    • 데이터 μžλ£Œν˜• ν™œμš©ν•˜κΈ°2
    • 데이터 κ°€μ§€κ³  놀기(μ‘μš©)1
    • 데이터 κ°€μ§€κ³  놀기(μ‘μš©)2
    • REST API
    • λ°°μ—΄ λ§Œλ“€κΈ°1
    • λ°°μ—΄ λ§Œλ“€κΈ°2
    • λ°°μ—΄ λ§Œλ“€κΈ°3
    • 비ꡬ쑰화 ν• λ‹Ή
    • rest + spread(μ‘μš©)1
    • rest + spread(μ‘μš©)2
    • rest + spread(μ‘μš©)3
    • 반볡문 λ‚΄μž₯ν•¨μˆ˜(μ‘μš©)1
    • ν•¨μˆ˜ κ°€μ§€κ³  놀기(μ‘μš©)1
    • μ„œλ²„μ™€μ˜ 톡신1
    • μ„œλ²„μ™€μ˜ 톡신2
    • new Promise(μ‘μš©)2
    • new Promise(μ‘μš©)3
    • μžλ°”μŠ€ν¬λ¦½νŠΈ 이벀트 μœ„μž„ 핡심 정리
Powered by GitBook
On this page
  • ν™”μ‚΄ν‘œ ν•¨μˆ˜(Arrow function)
  • 1. ν™”μ‚΄ν‘œ ν•¨μˆ˜μ˜ 기본문법
  • 2. 콜백 ν•¨μˆ˜μ—μ„œ μ‚¬μš©ν•˜κΈ°

Was this helpful?

  1. 01.Vanilla-JS
  2. 05. ν•¨μˆ˜

05-3. Arrow function

ν™”μ‚΄ν‘œ ν•¨μˆ˜(Arrow function)

ν™”μ‚΄ν‘œ ν•¨μˆ˜λŠ” ES6λ¬Έλ²•μž…λ‹ˆλ‹€. function ν‚€μ›Œλ“œ μ‚¬μš©ν•΄μ„œ ν•¨μˆ˜λ₯Ό λ§Œλ“  것보닀 κ°„λ‹¨νžˆ ν•¨μˆ˜λ₯Ό ν‘œν˜„ν•  수 μžˆμŠ΅λ‹ˆλ‹€. ν™”μ‚΄ν‘œ ν•¨μˆ˜λŠ” 항상 읡λͺ…μž…λ‹ˆλ‹€.

1. ν™”μ‚΄ν‘œ ν•¨μˆ˜μ˜ 기본문법

// λ§€κ°œλ³€μˆ˜κ°€ μ—†λŠ” 경우
const foo = () => console.log('bar');
foo(); // bar

// λ§€κ°œλ³€μˆ˜κ°€ ν•˜λ‚˜μΈ 경우 (κ°€λ‘œκ°€ ν•„μš” μ—†λ‹€.)
const foo = x => x;
foo('bar'); // bar

// λ§€κ°œλ³€μˆ˜κ°€ μ—¬λ €κ°œμΈ 경우 (κ°€λ‘œκ°€ ν•„μš” ν•©λ‹ˆλ‹€.)
const foo = (a, b) => a + b; // κ°„λ‹¨ν•˜κ²Œ ν•œμ€„λ‘œ ν‘œν˜„ν•  땐 "{}" μ—†μœΌλ©΄ 값이 λ°˜ν™˜(retuen)λ©λ‹ˆλ‹€.!!
foo(1, 2); // 3

const foo = (a, b) => { return a + b }; 
foo(1, 2); // 3

const foo = (a, b) => { a + b }; // "{}"λ₯Ό μ‚¬μš©ν–ˆλŠ”λ° return이 없을 λ•Œ 
foo(1, 2); // undefined

const foo = (a, b, c = 0) => { // μ—¬λŸ¬μ€„ 썼을 경우 
	return a + b + c;
}
foo(1, 2, 3) // 6

// μ¦‰μ‹œμ‹€ν–‰ν•¨μˆ˜λŠ” μ•„λž˜μ™€ 같이 ν‘œν˜„ν•  수 μžˆλ‹€.
(() => {
  console.log('foo');
})(); // foo

/*
1) "{}"을 μ‚¬μš©ν•  λ•ŒλŠ” μ—¬λŸ¬μ€„μ„ 썼을 λ•Œ μ‚¬μš©ν•©λ‹ˆλ‹€.
2) "{}"λ₯Ό μ‚¬μš©ν•˜λ©΄ 값을 λ°˜ν™˜ν•  λ•Œ return을 μ‚¬μš©ν•΄μ•Όν•©λ‹ˆλ‹€.
3) κ°„λ‹¨ν•˜κ²Œ ν•œμ€„λ‘œ ν‘œν˜„ν•  땐 "{}" μ—†μœΌλ©΄ 값이 λ°˜ν™˜(retuen)λ©λ‹ˆλ‹€.!!
4) "{}"λ₯Ό μ‚¬μš©ν•˜μ§€ μ•ŠμœΌλ©΄ undefiedλ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.
*/

// 객체λ₯Ό λ°˜ν™˜(return)ν•  λ•Œ
const foo = () => ( { a: 1, b: 2, c: 3 } );
foo(); // { a: 1, b: 2, c: 3 };

2. 콜백 ν•¨μˆ˜μ—μ„œ μ‚¬μš©ν•˜κΈ°

// ES5
var numbers = [1, 4, 9];
var oddArr = numbers.filter(function (x) { return x % 2 !== 0;});
console.log(oddArr); // [1, 9]
// ES6
var numbers = [1, 4, 9];
var oddArr = numbers.filter( x => (x % 2) !== 0 );
console.log(oddArr); // [1, 9]

Previous05-2. ν˜• λ³€ν™˜ ν•¨μˆ˜Next06. 객체

Last updated 4 years ago

Was this helpful?