SlideShare a Scribd company logo
OOPS in Javascriptpart 1
object?
object?instance of a type
OOPS in javascript
instance of type dart frog
OOPS in javascript
instances of type walrus
object?instance of a typetype represents anything a dart frog or a walrus
how to create objects?
how to create objects?let’s start with creating a type… say ‘dartfrog’
how to create objects?let’s start with creating a type… say ‘dartfrog’vardartfrog= function(){}
how to create objects?let’s start with creating a type… say ‘dartfrog’vardartfrog= function(){}type
adding properties andbehaviors
propertiesvardartfrog= function(){this.name = ‘’;this.color = ‘’;this.poisonous = true;}
propertiesvardartfrog= function(){this.name = ‘’;this.color = ‘’;this.poisonous = true;}properties
propertieslet’s fill the properties at the time of creation by passing values.vardartfrog= function(name, color, poisonous){this.name = name;this.color = color;this.poisonous = poisonous;}
behaviorsvardartfrog= function(name, color, poisonous){this.name = name;this.color = color;this.poisonous = poisonous;this.jump = function(){alert(“JUMP    JUMP     JUMP”);       } ;this.sing = function(){alert(“CROAK    CROAK   CROAK”);       }      }
behaviorsvardartfrog= function(name, color, poisonous){this.name = name;this.color = color;this.poisonous = poisonous;this.jump = function(){alert(“JUMP    JUMP     JUMP”);       } ;this.sing = function(){alert(“CROAK    CROAK   CROAK”);       }      }Methods or behaviors
let’s create some frogs and make them sing
creating objectsvarjackstraw = newdartfrog(“jackstraw”,                                                   “strawberry”,                                                   true);
creating objectsvarjackstraw = newdartfrog(“jackstraw”,                                                   “strawberry”,                                                   true);namecolorpoisonous?
creating objectsvarjackstraw = newdartfrog(“jackstraw”,                                                   “strawberry”,                                                   true);varstickyellow= newdartfrog(“stickyellow“,                                                    “yellow”,                                                     true);varblueman= newdartfrog(“blueman“,“blue”,                                                      true);
calling methodsGuys are you ready. come on sing!!jackstraw.sing();stickyellow.sing();blueman.sing();CROAK CROAKCROAKCROAK CROAKCROAKCROAK CROAKCROAK
ThankYou

More Related Content

ODP
Learn JavaScript by modeling Rubik Cube
PPTX
Advanced JavaScript
PDF
Advanced Object-Oriented JavaScript
PDF
몽고디비사용자교육2일차 v0.5
ODP
R과sql비교 퀵하게보기
PDF
보안 위협과 악성코드 분석 기법
PDF
Why javaScript?
PDF
Big query at GDG Korea Cloud meetup
Learn JavaScript by modeling Rubik Cube
Advanced JavaScript
Advanced Object-Oriented JavaScript
몽고디비사용자교육2일차 v0.5
R과sql비교 퀵하게보기
보안 위협과 악성코드 분석 기법
Why javaScript?
Big query at GDG Korea Cloud meetup

Viewers also liked (20)

PPTX
BeLAUNCH2014 x HACKATHON week 3
PDF
미티어 리엑티비티 ( reactivity of meteor )
PDF
Javascript and Web Performance
PDF
3. collection
PDF
1. 미티어의 폴더구조
PDF
5.router
PPTX
Google Apps를 활용한 Smart Work 구축
PDF
6.accounts
PDF
4. publish / subscribe
PDF
Meteor Korea DEV School 1st day
PDF
142 리눅스와 모바일 day1-track4_2_v1.5
PDF
Querydsl
PDF
Ksug2015 jpa4 객체지향쿼리
PDF
2. template
PPTX
몽고디비교육1일차
PDF
The MongoDB Strikes Back / MongoDB 의 역습
PDF
[D2CAMPUS]JavaScript 다시 시작하기
PDF
알아봅시다, Polymer: Web Components & Web Animations
PDF
Hoons닷넷 좌충우돌 10년, 그리고 새로운 패러다임
PPTX
Owasp에 대하여
BeLAUNCH2014 x HACKATHON week 3
미티어 리엑티비티 ( reactivity of meteor )
Javascript and Web Performance
3. collection
1. 미티어의 폴더구조
5.router
Google Apps를 활용한 Smart Work 구축
6.accounts
4. publish / subscribe
Meteor Korea DEV School 1st day
142 리눅스와 모바일 day1-track4_2_v1.5
Querydsl
Ksug2015 jpa4 객체지향쿼리
2. template
몽고디비교육1일차
The MongoDB Strikes Back / MongoDB 의 역습
[D2CAMPUS]JavaScript 다시 시작하기
알아봅시다, Polymer: Web Components & Web Animations
Hoons닷넷 좌충우돌 10년, 그리고 새로운 패러다임
Owasp에 대하여
Ad

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Machine Learning_overview_presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
Teaching material agriculture food technology
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation theory and applications.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Machine learning based COVID-19 study performance prediction
Review of recent advances in non-invasive hemoglobin estimation
Machine Learning_overview_presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Teaching material agriculture food technology
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
Chapter 3 Spatial Domain Image Processing.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Electronic commerce courselecture one. Pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation theory and applications.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine learning based COVID-19 study performance prediction
Ad

OOPS in javascript