일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Til
- 자료구조
- 데이터전송
- HTTP
- Machine Learning
- Linux
- docker
- Sequence
- 자바스크립트
- multer
- 스파르타코딩클럽
- ES6
- javascript
- 리눅스
- 러닝자바스크립트
- 우선순위
- React
- 객체
- 회고
- coursera
- 1일1문장
- 끈기
- reactnative
- 개발공부
- 클로저
- Andrew Ng
- CSS
- NextJS
- nodejs
- scope
- Today
- Total
목록CLASS (2)
해나아부지 개발일지

JavaScript는 Prototype 기반의 언어이기 때문에 class라는 개념이 없었다. 사용자의 편의성을 위해 ES6(ECMA Script 2015)가 적용되고 작동원리는 똑같지만 class라는 키워드를 사용하여 조금 더 객체지향적으로 보이는 코딩을 할 수 있게 됐달까? class //ES5 function Car(model, company, year) { this.model = model this.company = company this.year = year } Car.prototype.start = function () { console.log(this.model + "가 출발합니다") } Car.prototype.stop = function () { console.log(this.model +..
class Cat: species = "russian blue" #속성 정의 #인스턴스 생성시 개별적으로 부여할 속성을 만들 때 사용한다 def __init__(self, name, sex, 인자...): self.name = name //self - javascript에 this 역할인듯 self.sex = sex 현실세계의 개념을 추상화하는 객체! 파이썬에서도 자바스크립트와 마찬가지로 클래스명은 대문자로 써줘야함 Cat Cat이라는 공유 class를 가지고 여러 인스턴스 고양이를 만들 수가 있다 cat1 = Cat('냥1', '수컷') cat2 = Cat('냥2', '암컷') print(cat1.species) #russian blue print(cat2.species) #russian blue pr..