let & const
- 변수들의 범위를 변경
- let : 값을 수정할 수 있는 변수를 선언할 때 사용
- const : 한 번 지정하면 절대 변하지 않는 값인 상수를 선언할 때 사용
Arrow Functions
function printMyName(name) {
console.log(name);
}
printMyName('Max')
const printMyName = (name) => {
console.log(name)
}
printMyName('Max');
const multiply = (number) => {
return number * 2;
}
const multiply = number => number * 2;
- 화살표 함수는 키워드 this 로 인해 생겼던 많은 문제들을 해결해준다.
- 화살표 함수 안에 이 this 를 사용하면, 항상 정의한 객체를 나타낸다.
- 화살표 함수는 파라미터 인자가 하나 일 경우 괄호를 생략할 수 있다.
- 화살표 함수는 반환 하는 코드가 한 줄일 경우 중괄호를 생략할 수 있다.
Exports & Imports (Modules)


- default export : import 시 항상 default export 가 내보낸 것을 기본 값으로 가져온다.
- 예를 들어, person.js 를 import 하면 기본 값으로 const person 을 가져온다.
- named export : 중괄호를 통해 import 할 것의 이름을 정확히 명시해주어야 한다.
- 예를 들어, import { clean } from ‘./utility.js’
- 별칭(alias) 을 사용할 수 있으며 특수 문자(*) 을 사용하여 모든 것을 import 할 수 있다.
- import * as bundled from ‘./utility.js’
- ex) 사용 : bundled.clean, bundled.baseData
Classes

class Human {
constructor() {
this.gender = 'male';
}
printGender() {
console.log(this.gender);
}
}
class Person extends Human {
constructor() {
super();
this.name = 'Max';
}
printMyName() {
console.log(this.name);
}
}
const person = new Person();
person.printMyName(); // Max
person.printGender(); // male