Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 객체
- 쌍방향 연결리스트
- 인접 형제 선택자 결합
- nth-child()
- 가상 요소 선택자
- innerhtml
- 양방향 연결리스트
- filter()
- invalid assignment left-hand side
- map()
- Array.from()
- 배열의 내림차순
- indexOf
- 배열의 오름차순
- display : none
- Link
- 배열과 연결리스트의 차이
- 범용 선택자
- for..of
- Sort
- CSS
- 등차수열의 항 찾기
- 일반 형제 선택자 결합
- 고차함수
- visibility : hidden
- 단방향 연결리스트
- Em
- 백준알고리즘
- classList.contains(string)
- disabled
Archives
- Today
- Total
프론트엔드 센트럴파크 (☞゚ヮ゚)☞
commonJS로 JS파일 연동하기 본문
주는 파일(Export)
/**
* CommonJS (Export)
*/
function Person(name, age, location) {
this.name = name;
this.age = age;
this.location = location;
this.getName = function () {
return this.name + '입니다';
};
}
module.exports = Person;
받는 파일(Import)
- require 을 사용한다.
/**
* CommonJS (Import)
*/
const Person = require('./02-CommonJS-person');
const me = new Person('jang', 10, 'Korea');
const you = new Person('kim', 20, 'China');
console.log(me.getName());
console.log(you.getName());
'Javascript' 카테고리의 다른 글
프로토타입 (0) | 2022.07.27 |
---|---|
classList.contains(string) (0) | 2022.07.23 |
거듭제곱 / 제곱근 (0) | 2022.07.20 |
배열 숫자의 오름차순, 내림차순 정렬 (0) | 2022.07.20 |
배열 내 모든 요소가 콜백 함수의 조건을 만족하면 true/false - every() (0) | 2022.07.20 |
Comments