SlideShare una empresa de Scribd logo
1 de 24
OOPS in Javascript part 1
object?
object? instance of a type
instance of type dart frog
instances of type walrus
object? instance of a type type 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
properties vardartfrog= function(){ this.name = ‘’; this.color = ‘’; this.poisonous = true;}
properties vardartfrog= function(){ this.name = ‘’; this.color = ‘’; this.poisonous = true;} properties
properties let’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;}
behaviors vardartfrog= 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”);       }      }
behaviors vardartfrog= 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 objects varjackstraw = newdartfrog(“jackstraw”,                                                    “strawberry”,                                                    true);
creating objects varjackstraw = newdartfrog(“jackstraw”,                                                    “strawberry”,                                                    true); name color poisonous?
creating objects varjackstraw = newdartfrog(“jackstraw”,                                                    “strawberry”,                                                    true); varstickyellow= newdartfrog(“stickyellow“,                                                     “yellow”,                                                      true); varblueman= newdartfrog(“blueman“, “blue”,                                                       true);
calling methods Guys are you ready. come on sing!! jackstraw.sing(); stickyellow.sing(); blueman.sing(); CROAK CROAKCROAK CROAK CROAKCROAK CROAK CROAKCROAK
ThankYou

Más contenido relacionado

Destacado

BeLAUNCH2014 x HACKATHON week 3
BeLAUNCH2014 x HACKATHON week 3BeLAUNCH2014 x HACKATHON week 3
BeLAUNCH2014 x HACKATHON week 3
Chan Lee
 
142 리눅스와 모바일 day1-track4_2_v1.5
142 리눅스와 모바일 day1-track4_2_v1.5142 리눅스와 모바일 day1-track4_2_v1.5
142 리눅스와 모바일 day1-track4_2_v1.5
NAVER D2
 

Destacado (20)

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

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

OOPS in javascript