GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaScript_docs/06.class/1.basic.js at main · dev-language/JavaScript_docs

Expand file tree

/

1.basic.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
50 lines (42 loc) · 1.36 KB
/

1.basic.js

Copy path

File metadata and controls

50 lines (42 loc) · 1.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 객체를 쉽게 만들 수 있는 템플릿 종류
// 1. 생성자 함수 ( 현업에서 거의 사용되지 않음)
// 2. 클래스 ( 현업에서 사용 )
//! 아래 생성자 함수를 클래스로 바꿔보자!
// function Idcard(name, title) {
// this.name = name;
// this.title = title;
// this.display = () => {
// console.log(`${this.name}: ${this.title}`);
// };
// }
// const newIdCard = new Idcard('서근', '서근 개발노트');
// const newIdCard2 = new Idcard('미진', '미진 개발노트');
// console.log(newIdCard);
// console.log(newIdCard2);
class IdCard {
constructor(name, title) {
this.name = name;
this.title = title;
}
// 클래스에서의 함수는 생서자 밖에서 등록하면 된다.
display = () => {
console.log(`${this.name}: ${this.title}`);
};
}
// newIdCard는 IdCard의 인스턴스 이다.
const newIdCard = new IdCard('서근', '서근 개발노트');
const newIdCard2 = new IdCard('미진', '미진 개발노트');
console.log(newIdCard);
console.log(newIdCard2);
console.log(newIdCard.display());
class Samsung {
constructor(name, version) {
this.name = name;
this.version = version;
}
display = () => {
console.log(`${this.name} ${this.version}`);
};
}
const s22 = new Samsung('갤럭시', 's22');
console.log(s22.display());
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.