SlideShare a Scribd company logo
Object-Oriented JavaScript
!
!
!
!
var oName = {name : “javascript”, getName : function() {return this.name}};!
var oName2 = {name : “c#”, getName : function() {return this.name}};!
var oName3 = {name : “original”, getName : function() {return this.name}};!
!
!
var oName = {name : “javascript”, getName : function() {return this.name}};!
var oName2 = {name : “c#”, getName : function() {return this.name}};!
var oName3 = {name : “original”, getName : function() {return this.name}};!
!
function Name(name) {!
this.name = name;

this.getName = function() {!
return this.name;!
};

this.setName = function(newName) {!
this.name = newName;!
};!
}!
!
!
var obj = new Name("javascript");!
obj.getName();!
!
var obj = new Name(“C#”);!
obj.getName();
function Name(name) {!
this.name = name;

this.getName = function() {!
return this.name;!
};

this.setName = function(newName) {!
this.name = newName;!
};!
}!
!
!
var obj = new Name("javascript");!
obj.getName();!
!
var obj2 = new Name(“C#”);!
obj2.getName();!
!
obj.getName === obj2.getName; //false
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
obj.getName();!
!
var obj2 = new Name(“C#”);!
obj2.getName();!
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
obj.getName();!
!
var obj2 = new Name(“C#”);!
obj2.getName();!
obj.getName === obj2.getName; //true
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
debugger;!
obj.getName();!
!
var obj2 = new Name("C#");!
obj2.getName();!
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
debugger;!
obj.getName();!
!
var obj2 = new Name("C#");!
obj2.getName();!
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
debugger;!
obj.getName();!
!
var obj2 = new Name("C#");!
obj2.getName();!
obj.__proto__
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
debugger;!
obj.getName();!
!
var obj2 = new Name("C#");!
obj2.getName();!
obj.__proto__ == Name.prototype
?
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
debugger;!
obj.getName();!
!
var obj2 = new Name("C#");!
obj2.getName();!
obj.constructor === Name

//true
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
debugger;!
obj.getName();!
!
var obj2 = new Name("C#");!
obj2.getName();!
obj instanceof Name 

//true
function Name(name) {!
this.name = name;!
}!
!
Name.prototype.getName = function() {!
return this.name;!
};

Name.prototype.setName = function(newName) {!
this.name = newName;!
};!
!
!
!
var obj = new Name("javascript");!
debugger;!
obj.getName();!
!
var obj2 = new Name("C#");!
obj2.getName();!
obj instanceof Name 

//true
!
obj instanceof Object
//true.
// 상속받은 생성자도 true로 나옴
var nameModel = {};!
!
!
var nameController = {!


getName : function() {!
return this.name;!
},!
setName : function(newName) {!
this.name = newName;!
}!
}!
!
!
nameController.setName.call(nameModel,"javascript");!
nameController.getName.call(nameModel);!
var nameModel = {};!
!
var nameController = {!


getName : function() {!
return this.name;!
},!
setName : function(newName) {!
this.name = newName;!
}!
}!
!
nameController.setName.call(nameModel,"javascript");!
nameController.getName.call(nameModel);!
!
var nameModel2 = {};!
nameController.setName.call(nameModel2, "java");!
nameController.getName.call(nameModel2);
!
JavaScript OOP Pattern

More Related Content

What's hot

Boot strap.groovy
Boot strap.groovyBoot strap.groovy
Boot strap.groovy
Vijay Shukla
 
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
Tsuyoshi Yamamoto
 
Jasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyJasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishy
Igor Napierala
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
Tsuyoshi Yamamoto
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
pratiknaik
 
Lies, Damn Lies, and Benchmarks
Lies, Damn Lies, and BenchmarksLies, Damn Lies, and Benchmarks
Lies, Damn Lies, and Benchmarks
Workhorse Computing
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with Jasmine
Tim Tyrrell
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
Visual Engineering
 
Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.js
Matthew Beale
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for JoomlaLuke Summerfield
 
Extracting ruby gem
Extracting ruby gemExtracting ruby gem
Extracting ruby gem
Yura Tolstik
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
Konstantin Käfer
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
bpmedley
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
Piotr Pelczar
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
xSawyer
 
Any event intro
Any event introAny event intro
Any event intro
qiang
 
Mojo as a_client
Mojo as a_clientMojo as a_client
Mojo as a_client
Marcus Ramberg
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
Adam Wiggins
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
Joseph Chiang
 

What's hot (20)

Boot strap.groovy
Boot strap.groovyBoot strap.groovy
Boot strap.groovy
 
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
第4回 g* ワークショップ はじめてみよう! Grailsプラグイン
 
Jasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishyJasmine - why JS tests don't smell fishy
Jasmine - why JS tests don't smell fishy
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
Lies, Damn Lies, and Benchmarks
Lies, Damn Lies, and BenchmarksLies, Damn Lies, and Benchmarks
Lies, Damn Lies, and Benchmarks
 
Testing Javascript with Jasmine
Testing Javascript with JasmineTesting Javascript with Jasmine
Testing Javascript with Jasmine
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
 
Containers & Dependency in Ember.js
Containers & Dependency in Ember.jsContainers & Dependency in Ember.js
Containers & Dependency in Ember.js
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
Extracting ruby gem
Extracting ruby gemExtracting ruby gem
Extracting ruby gem
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
Any event intro
Any event introAny event intro
Any event intro
 
Mojo as a_client
Mojo as a_clientMojo as a_client
Mojo as a_client
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 
JavaScript Promise
JavaScript PromiseJavaScript Promise
JavaScript Promise
 

Viewers also liked

[WEB UI BASIC] Javascript 2탄
[WEB UI BASIC] Javascript 2탄[WEB UI BASIC] Javascript 2탄
[WEB UI BASIC] Javascript 2탄
Jae Woo Woo
 
자바카페 스터디- INSIDE JS 1-3
자바카페 스터디- INSIDE JS 1-3자바카페 스터디- INSIDE JS 1-3
자바카페 스터디- INSIDE JS 1-3
Jin-Hyun Park
 
WEBUI Advanced중간시험
WEBUI Advanced중간시험WEBUI Advanced중간시험
WEBUI Advanced중간시험
지수 윤
 
9주 dom & event advanced
9주  dom & event advanced9주  dom & event advanced
9주 dom & event advanced지수 윤
 
160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'
160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'
160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'
재원 변
 
7주 JavaScript 실습
7주 JavaScript 실습7주 JavaScript 실습
7주 JavaScript 실습
지수 윤
 
재사용가능한 서비스코드제작
재사용가능한 서비스코드제작재사용가능한 서비스코드제작
재사용가능한 서비스코드제작
지수 윤
 
자바스크립트 핵심 가이드
자바스크립트 핵심 가이드자바스크립트 핵심 가이드
자바스크립트 핵심 가이드
재원 변
 
퍼블리셔, 디자인을 퍼블리싱하다
퍼블리셔, 디자인을 퍼블리싱하다퍼블리셔, 디자인을 퍼블리싱하다
퍼블리셔, 디자인을 퍼블리싱하다
jeong seok yang
 
명세부터 깨우치는 FILEAPI
명세부터 깨우치는 FILEAPI명세부터 깨우치는 FILEAPI
명세부터 깨우치는 FILEAPI우영 주
 
앱밤_시간표
앱밤_시간표앱밤_시간표
앱밤_시간표재원 변
 
Javascript Closure
Javascript ClosureJavascript Closure
Javascript Closure지수 윤
 
JavaScript Debugging (동영상강의자료)
JavaScript Debugging (동영상강의자료)JavaScript Debugging (동영상강의자료)
JavaScript Debugging (동영상강의자료)
지수 윤
 
JS특징(scope,this,closure)
JS특징(scope,this,closure)JS특징(scope,this,closure)
JS특징(scope,this,closure)
지수 윤
 
비동기와 이벤트큐 수업자료
비동기와 이벤트큐 수업자료비동기와 이벤트큐 수업자료
비동기와 이벤트큐 수업자료
지수 윤
 
웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트
웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트
웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트
Rhio Kim
 
크로스브라우징
크로스브라우징크로스브라우징
크로스브라우징
지수 윤
 
7주 JavaScript Part2
7주 JavaScript Part27주 JavaScript Part2
7주 JavaScript Part2
지수 윤
 
4주 CSS Layout
4주 CSS Layout4주 CSS Layout
4주 CSS Layout지수 윤
 
8주 dom & event basic
8주  dom & event basic8주  dom & event basic
8주 dom & event basic지수 윤
 

Viewers also liked (20)

[WEB UI BASIC] Javascript 2탄
[WEB UI BASIC] Javascript 2탄[WEB UI BASIC] Javascript 2탄
[WEB UI BASIC] Javascript 2탄
 
자바카페 스터디- INSIDE JS 1-3
자바카페 스터디- INSIDE JS 1-3자바카페 스터디- INSIDE JS 1-3
자바카페 스터디- INSIDE JS 1-3
 
WEBUI Advanced중간시험
WEBUI Advanced중간시험WEBUI Advanced중간시험
WEBUI Advanced중간시험
 
9주 dom & event advanced
9주  dom & event advanced9주  dom & event advanced
9주 dom & event advanced
 
160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'
160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'
160716 클리어보스 발표자료 '내 인생의 첫 번째 스타트업'
 
7주 JavaScript 실습
7주 JavaScript 실습7주 JavaScript 실습
7주 JavaScript 실습
 
재사용가능한 서비스코드제작
재사용가능한 서비스코드제작재사용가능한 서비스코드제작
재사용가능한 서비스코드제작
 
자바스크립트 핵심 가이드
자바스크립트 핵심 가이드자바스크립트 핵심 가이드
자바스크립트 핵심 가이드
 
퍼블리셔, 디자인을 퍼블리싱하다
퍼블리셔, 디자인을 퍼블리싱하다퍼블리셔, 디자인을 퍼블리싱하다
퍼블리셔, 디자인을 퍼블리싱하다
 
명세부터 깨우치는 FILEAPI
명세부터 깨우치는 FILEAPI명세부터 깨우치는 FILEAPI
명세부터 깨우치는 FILEAPI
 
앱밤_시간표
앱밤_시간표앱밤_시간표
앱밤_시간표
 
Javascript Closure
Javascript ClosureJavascript Closure
Javascript Closure
 
JavaScript Debugging (동영상강의자료)
JavaScript Debugging (동영상강의자료)JavaScript Debugging (동영상강의자료)
JavaScript Debugging (동영상강의자료)
 
JS특징(scope,this,closure)
JS특징(scope,this,closure)JS특징(scope,this,closure)
JS특징(scope,this,closure)
 
비동기와 이벤트큐 수업자료
비동기와 이벤트큐 수업자료비동기와 이벤트큐 수업자료
비동기와 이벤트큐 수업자료
 
웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트
웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트
웹 소프트웨어 시대의 새로운 롤(role) 모델, 자바스크립트
 
크로스브라우징
크로스브라우징크로스브라우징
크로스브라우징
 
7주 JavaScript Part2
7주 JavaScript Part27주 JavaScript Part2
7주 JavaScript Part2
 
4주 CSS Layout
4주 CSS Layout4주 CSS Layout
4주 CSS Layout
 
8주 dom & event basic
8주  dom & event basic8주  dom & event basic
8주 dom & event basic
 

Similar to JavaScript OOP Pattern

Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design Patterns
Robert Casanova
 
JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)
jeresig
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
Stoyan Stefanov
 
Java script object model
Java script object modelJava script object model
Java script object modelJames Hsieh
 
Javascript3
Javascript3Javascript3
Javascript3mozks
 
Javascript - The Good, the Bad and the Ugly
Javascript - The Good, the Bad and the UglyJavascript - The Good, the Bad and the Ugly
Javascript - The Good, the Bad and the Ugly
Thorsten Suckow-Homberg
 
manager
managermanager
manager
phuong Ho
 
04 Advanced Javascript
04 Advanced Javascript04 Advanced Javascript
04 Advanced Javascript
crgwbr
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
LearningTech
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Seri Moth
 
F(1)
F(1)F(1)
Journey of a C# developer into Javascript
Journey of a C# developer into JavascriptJourney of a C# developer into Javascript
Journey of a C# developer into Javascript
Massimo Franciosa
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5arajivmordani
 
OO in JavaScript
OO in JavaScriptOO in JavaScript
OO in JavaScript
Gunjan Kumar
 
[A 3]Javascript oop for xpages developers - public
[A 3]Javascript oop for xpages developers - public[A 3]Javascript oop for xpages developers - public
[A 3]Javascript oop for xpages developers - public
Kazunori Tatsuki
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues

Similar to JavaScript OOP Pattern (20)

Plugin jQuery, Design Patterns
Plugin jQuery, Design PatternsPlugin jQuery, Design Patterns
Plugin jQuery, Design Patterns
 
JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
 
Java script object model
Java script object modelJava script object model
Java script object model
 
Javascript
JavascriptJavascript
Javascript
 
Es.next
Es.nextEs.next
Es.next
 
Javascript3
Javascript3Javascript3
Javascript3
 
Javascript - The Good, the Bad and the Ugly
Javascript - The Good, the Bad and the UglyJavascript - The Good, the Bad and the Ugly
Javascript - The Good, the Bad and the Ugly
 
manager
managermanager
manager
 
04 Advanced Javascript
04 Advanced Javascript04 Advanced Javascript
04 Advanced Javascript
 
F[4]
F[4]F[4]
F[4]
 
JavaScript - Chapter 7 - Advanced Functions
 JavaScript - Chapter 7 - Advanced Functions JavaScript - Chapter 7 - Advanced Functions
JavaScript - Chapter 7 - Advanced Functions
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
 
F(1)
F(1)F(1)
F(1)
 
Journey of a C# developer into Javascript
Journey of a C# developer into JavascriptJourney of a C# developer into Javascript
Journey of a C# developer into Javascript
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
OO in JavaScript
OO in JavaScriptOO in JavaScript
OO in JavaScript
 
[A 3]Javascript oop for xpages developers - public
[A 3]Javascript oop for xpages developers - public[A 3]Javascript oop for xpages developers - public
[A 3]Javascript oop for xpages developers - public
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 

More from 지수 윤

HTML,CSS Next
HTML,CSS NextHTML,CSS Next
HTML,CSS Next
지수 윤
 
코드스쿼드 마스터즈세미나 - UI개발자가돼보자
코드스쿼드 마스터즈세미나 - UI개발자가돼보자코드스쿼드 마스터즈세미나 - UI개발자가돼보자
코드스쿼드 마스터즈세미나 - UI개발자가돼보자
지수 윤
 
Clean Front-End Development
Clean Front-End DevelopmentClean Front-End Development
Clean Front-End Development
지수 윤
 
개발자를 알아보자.
개발자를 알아보자.개발자를 알아보자.
개발자를 알아보자.
지수 윤
 
재사용UI 컴포넌트설계
재사용UI 컴포넌트설계재사용UI 컴포넌트설계
재사용UI 컴포넌트설계
지수 윤
 
Front-End 개발의 괜찮은 선택 ES6 & React
Front-End 개발의 괜찮은 선택  ES6 & ReactFront-End 개발의 괜찮은 선택  ES6 & React
Front-End 개발의 괜찮은 선택 ES6 & React
지수 윤
 
WEB Front-End 개발과정 살펴보기
WEB Front-End 개발과정 살펴보기WEB Front-End 개발과정 살펴보기
WEB Front-End 개발과정 살펴보기
지수 윤
 
JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)
지수 윤
 
CSS Layout
CSS LayoutCSS Layout
CSS Layout
지수 윤
 
더 나은 SW프로젝트를 위해
 더 나은 SW프로젝트를 위해 더 나은 SW프로젝트를 위해
더 나은 SW프로젝트를 위해
지수 윤
 
9주 DOM & Event Advanced
9주  DOM & Event Advanced9주  DOM & Event Advanced
9주 DOM & Event Advanced
지수 윤
 
7주 JavaScript Part1
7주 JavaScript Part17주 JavaScript Part1
7주 JavaScript Part1
지수 윤
 
6주 javaScript 시작하며
6주  javaScript 시작하며6주  javaScript 시작하며
6주 javaScript 시작하며
지수 윤
 
10주 ajax 실습
10주 ajax 실습10주 ajax 실습
10주 ajax 실습지수 윤
 
8주 dom & event basic 실습
8주  dom & event basic 실습8주  dom & event basic 실습
8주 dom & event basic 실습지수 윤
 
9주 dom & event advanced 실습
9주  dom & event advanced 실습9주  dom & event advanced 실습
9주 dom & event advanced 실습지수 윤
 
5주 모바일웹과 반응형웹
5주 모바일웹과 반응형웹5주 모바일웹과 반응형웹
5주 모바일웹과 반응형웹지수 윤
 
3주 CSS Basic
3주 CSS Basic3주 CSS Basic
3주 CSS Basic
지수 윤
 

More from 지수 윤 (19)

HTML,CSS Next
HTML,CSS NextHTML,CSS Next
HTML,CSS Next
 
코드스쿼드 마스터즈세미나 - UI개발자가돼보자
코드스쿼드 마스터즈세미나 - UI개발자가돼보자코드스쿼드 마스터즈세미나 - UI개발자가돼보자
코드스쿼드 마스터즈세미나 - UI개발자가돼보자
 
Clean Front-End Development
Clean Front-End DevelopmentClean Front-End Development
Clean Front-End Development
 
개발자를 알아보자.
개발자를 알아보자.개발자를 알아보자.
개발자를 알아보자.
 
재사용UI 컴포넌트설계
재사용UI 컴포넌트설계재사용UI 컴포넌트설계
재사용UI 컴포넌트설계
 
Front-End 개발의 괜찮은 선택 ES6 & React
Front-End 개발의 괜찮은 선택  ES6 & ReactFront-End 개발의 괜찮은 선택  ES6 & React
Front-End 개발의 괜찮은 선택 ES6 & React
 
WEB Front-End 개발과정 살펴보기
WEB Front-End 개발과정 살펴보기WEB Front-End 개발과정 살펴보기
WEB Front-End 개발과정 살펴보기
 
JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)
 
CSS Layout
CSS LayoutCSS Layout
CSS Layout
 
더 나은 SW프로젝트를 위해
 더 나은 SW프로젝트를 위해 더 나은 SW프로젝트를 위해
더 나은 SW프로젝트를 위해
 
9주 DOM & Event Advanced
9주  DOM & Event Advanced9주  DOM & Event Advanced
9주 DOM & Event Advanced
 
7주 JavaScript Part1
7주 JavaScript Part17주 JavaScript Part1
7주 JavaScript Part1
 
6주 javaScript 시작하며
6주  javaScript 시작하며6주  javaScript 시작하며
6주 javaScript 시작하며
 
10주 ajax
10주 ajax10주 ajax
10주 ajax
 
10주 ajax 실습
10주 ajax 실습10주 ajax 실습
10주 ajax 실습
 
8주 dom & event basic 실습
8주  dom & event basic 실습8주  dom & event basic 실습
8주 dom & event basic 실습
 
9주 dom & event advanced 실습
9주  dom & event advanced 실습9주  dom & event advanced 실습
9주 dom & event advanced 실습
 
5주 모바일웹과 반응형웹
5주 모바일웹과 반응형웹5주 모바일웹과 반응형웹
5주 모바일웹과 반응형웹
 
3주 CSS Basic
3주 CSS Basic3주 CSS Basic
3주 CSS Basic
 

Recently uploaded

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 

Recently uploaded (20)

Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 

JavaScript OOP Pattern

  • 2. !
  • 3. !
  • 4.
  • 5.
  • 6. !
  • 7.
  • 8.
  • 9. ! var oName = {name : “javascript”, getName : function() {return this.name}};! var oName2 = {name : “c#”, getName : function() {return this.name}};! var oName3 = {name : “original”, getName : function() {return this.name}};! !
  • 10. ! var oName = {name : “javascript”, getName : function() {return this.name}};! var oName2 = {name : “c#”, getName : function() {return this.name}};! var oName3 = {name : “original”, getName : function() {return this.name}};! !
  • 11. function Name(name) {! this.name = name;
 this.getName = function() {! return this.name;! };
 this.setName = function(newName) {! this.name = newName;! };! }! ! ! var obj = new Name("javascript");! obj.getName();! ! var obj = new Name(“C#”);! obj.getName();
  • 12. function Name(name) {! this.name = name;
 this.getName = function() {! return this.name;! };
 this.setName = function(newName) {! this.name = newName;! };! }! ! ! var obj = new Name("javascript");! obj.getName();! ! var obj2 = new Name(“C#”);! obj2.getName();! ! obj.getName === obj2.getName; //false
  • 13. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! obj.getName();! ! var obj2 = new Name(“C#”);! obj2.getName();!
  • 14. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! obj.getName();! ! var obj2 = new Name(“C#”);! obj2.getName();! obj.getName === obj2.getName; //true
  • 15. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! debugger;! obj.getName();! ! var obj2 = new Name("C#");! obj2.getName();!
  • 16. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! debugger;! obj.getName();! ! var obj2 = new Name("C#");! obj2.getName();!
  • 17. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! debugger;! obj.getName();! ! var obj2 = new Name("C#");! obj2.getName();! obj.__proto__
  • 18. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! debugger;! obj.getName();! ! var obj2 = new Name("C#");! obj2.getName();! obj.__proto__ == Name.prototype ?
  • 19. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! debugger;! obj.getName();! ! var obj2 = new Name("C#");! obj2.getName();! obj.constructor === Name
 //true
  • 20. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! debugger;! obj.getName();! ! var obj2 = new Name("C#");! obj2.getName();! obj instanceof Name 
 //true
  • 21. function Name(name) {! this.name = name;! }! ! Name.prototype.getName = function() {! return this.name;! };
 Name.prototype.setName = function(newName) {! this.name = newName;! };! ! ! ! var obj = new Name("javascript");! debugger;! obj.getName();! ! var obj2 = new Name("C#");! obj2.getName();! obj instanceof Name 
 //true ! obj instanceof Object //true. // 상속받은 생성자도 true로 나옴
  • 22. var nameModel = {};! ! ! var nameController = {! 
 getName : function() {! return this.name;! },! setName : function(newName) {! this.name = newName;! }! }! ! ! nameController.setName.call(nameModel,"javascript");! nameController.getName.call(nameModel);!
  • 23. var nameModel = {};! ! var nameController = {! 
 getName : function() {! return this.name;! },! setName : function(newName) {! this.name = newName;! }! }! ! nameController.setName.call(nameModel,"javascript");! nameController.getName.call(nameModel);! ! var nameModel2 = {};! nameController.setName.call(nameModel2, "java");! nameController.getName.call(nameModel2);
  • 24.
  • 25. !