본문 바로가기
JavaScript/Youtube

JavaScript/Traversy Media - ES6

by SKim입니다 2020. 6. 23.

3. Let and Const Declaration

let - block level scopes를 가질 수 있다.

 = global scope에서 변수를 선언한 후에,

   loop나 if문 안에서 똑같은 변수를 선언한다면,

   둘은 완전히 다른 변수가 된다.

 

"use strict"

 

var를 썼을 때,

 

7행에서 변수 a를 global scope로 30으로 set했다.

if문 안에서 변수 a를 50으로 set했다.

 

 

 

 

let을 썼을 때,

 

18행이 16행을 change하지 않는다.

 

 

const - push는 가능하지만 change는 불가능

 

 

 

4. Classes and Inheritance

 

constructor

- class가 instantiate될 때

  (= object가 create될 때)

  run하는 메소드

- parameter를 take in할 수 있다.

 

object를 instantiate하기 위해 사용하는 변수(bob)를 쓰고,

call하기를 원하는 메소드를 쓰면 된다.

 

 

 

< static method >

※ static을 쓰지 말아야 할 경우

- register

 ∵ you need to instantiate an object

  in order to do it all right

 

class 이름. 메소드 이름();

 

 

< inherit / extend >

 

 

 

 

5. Template Literals

함수도 쓸 수 있다.

 

 

 

 

6. New String & Number Methods

 

 

 

 

 

 

 

7. Default Params & Spread Operator

 

spread operator

 

 

 

8. Set, Map, WeakSet and WeakMap

 

 

weakSet, weakMap - object 관련

 

 

 

9. Arrow Functions

 

 

 

10. Promises

 

 

 

11. Generators

 

 

 

youtu.be/2LeqilIw-28

 

댓글