際際滷

際際滷Share a Scribd company logo
JavaScript
                           The prototype Property




Thursday, November 1, 12
Brief


                           Whats OOP?

                           JavaScript OOP

                           Prototype

                           Inheritance




Thursday, November 1, 12
Whats OOP?
                              Introducir a OOP
                           Presentar el vocabulario




Thursday, November 1, 12
Object Oriented Programming




Thursday, November 1, 12
Programming paradigm




Thursday, November 1, 12
Data abstraction

                           Encapsulation

                           Messaging

                           Modularity

                           Polymorphism

                           Inheritance


Thursday, November 1, 12
Use object based on the real
                        world




Thursday, November 1, 12
Class vs Object




Thursday, November 1, 12
Class

                           A Class de鍖nes Objects

                           Properties
                               An object characteristic, such as color


                           Methods
                               An object capability, such as walk




Thursday, November 1, 12
Objects

                           A instance of a Class

                           Share properties and behavior

                           Unique




Thursday, November 1, 12
Class




Thursday, November 1, 12
Class




                Object1

Thursday, November 1, 12
Class




                Object1    Object2

Thursday, November 1, 12
Class




                Object1    Object2   Object3

Thursday, November 1, 12
Exercise




Thursday, November 1, 12
JavaScript OOP
                            Aplicar JavaScript OOP




Thursday, November 1, 12
JavaScript is a
                           prototypal language



Thursday, November 1, 12
Prototype-based
                                 programming
                           Class free

                           Classes are not present

                           Not Object Oriented

                           Everything is public

                           Objects inherits from another objects



Thursday, November 1, 12
Objects in JavaScript




Thursday, November 1, 12
Everything is an object




Thursday, November 1, 12
Arrays




                    Everything is an object




Thursday, November 1, 12
Arrays
                                    Dates


                    Everything is an object




Thursday, November 1, 12
Arrays
                                    Dates


                    Everything is an object

                                    Objects



Thursday, November 1, 12
Arrays
                                          Dates


                    Everything is an object

                                          Objects

                                Strings
Thursday, November 1, 12
Arrays
                                          Dates


                    Everything is an object

               Numbers                    Objects

                                Strings
Thursday, November 1, 12
They have methods and
                          properties



Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Custom Objects




Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Not reuse




Thursday, November 1, 12
Not reuse




                            Unique




Thursday, November 1, 12
Not reuse

                           Singleton
                            Pattern

                                 Unique




Thursday, November 1, 12
Exercise




Thursday, November 1, 12
Constructors




Thursday, November 1, 12
Constructor
                           Functions

                           Classes

                           Create diferents instances ==> Objects

                           Use new operator

                           Accepts parameters

                           Returns an instance ==> Object


Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Constructor
                           Has properties and methods

                             length

                             constructor

                             apply()

                             call()

                             prototype


Thursday, November 1, 12
Thursday, November 1, 12
Prototype




Thursday, November 1, 12
Prototype

                           A property

                           De鍖nes properties and methods to all
                           instances

                           Works with new operator

                           Stored in the memory once

                           Contain an Object

                             initial value === empty Object === {}
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Inheritance




Thursday, November 1, 12
Inheritance
                           A new class is created from another class

                           Extends functionality

                           De鍖nes new attributes and methods

                           A way to reuse code

                           All Object inherit from Object.prototype

                           12+ ways to inherits in JS


Thursday, November 1, 12
Prototype Chaining
                                Pseudo-clasical




Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Thursday, November 1, 12
Inherited




Thursday, November 1, 12
Inherited




Thursday, November 1, 12
Own




Thursday, November 1, 12
The End




Thursday, November 1, 12

More Related Content

Viewers also liked (13)

JavaScript Inheritence
JavaScript  InheritenceJavaScript  Inheritence
JavaScript Inheritence
Pawel Szymczykowski
New ES6 Hotness
New ES6 HotnessNew ES6 Hotness
New ES6 Hotness
Pawel Szymczykowski
2012 oct-12 - java script inheritance
2012 oct-12 - java script inheritance2012 oct-12 - java script inheritance
2012 oct-12 - java script inheritance
pedro.carvalho
Javascript foundations: Inheritance
Javascript foundations: InheritanceJavascript foundations: Inheritance
Javascript foundations: Inheritance
John Hunter
JavaScript Inheritance
JavaScript InheritanceJavaScript Inheritance
JavaScript Inheritance
Jussi Pohjolainen
Basic inheritance in JavaScript
Basic inheritance in JavaScriptBasic inheritance in JavaScript
Basic inheritance in JavaScript
Brian Moschel
03. Introduccion a JavaScript y JQuery03. Introduccion a JavaScript y JQuery
03. Introduccion a JavaScript y JQuery
Danae Aguilar Guzm叩n
JavaScript and Internet Controlled Hardware Prototyping
JavaScript and Internet Controlled Hardware PrototypingJavaScript and Internet Controlled Hardware Prototyping
JavaScript and Internet Controlled Hardware Prototyping
Jonathan LeBlanc
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
Stoyan Stefanov
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
Jussi Pohjolainen
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
raja kvk
Javascript Prototype Visualized
Javascript Prototype VisualizedJavascript Prototype Visualized
Javascript Prototype Visualized
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
Volodymyr Voytyshyn
2012 oct-12 - java script inheritance
2012 oct-12 - java script inheritance2012 oct-12 - java script inheritance
2012 oct-12 - java script inheritance
pedro.carvalho
Javascript foundations: Inheritance
Javascript foundations: InheritanceJavascript foundations: Inheritance
Javascript foundations: Inheritance
John Hunter
Basic inheritance in JavaScript
Basic inheritance in JavaScriptBasic inheritance in JavaScript
Basic inheritance in JavaScript
Brian Moschel
03. Introduccion a JavaScript y JQuery03. Introduccion a JavaScript y JQuery
03. Introduccion a JavaScript y JQuery
Danae Aguilar Guzm叩n
JavaScript and Internet Controlled Hardware Prototyping
JavaScript and Internet Controlled Hardware PrototypingJavaScript and Internet Controlled Hardware Prototyping
JavaScript and Internet Controlled Hardware Prototyping
Jonathan LeBlanc
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
Jussi Pohjolainen
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
raja kvk
Javascript Prototype Visualized
Javascript Prototype VisualizedJavascript Prototype Visualized
Javascript Prototype Visualized
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
Volodymyr Voytyshyn

More from Guillermo Paz (7)

User FirstUser First
User First
Guillermo Paz
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]
Guillermo Paz
Decoupling your JavaScript
Decoupling your JavaScriptDecoupling your JavaScript
Decoupling your JavaScript
Guillermo Paz
HTML5: Introduction
HTML5: IntroductionHTML5: Introduction
HTML5: Introduction
Guillermo Paz
Est叩ndares Web con Chico UIEst叩ndares Web con Chico UI
Est叩ndares Web con Chico UI
Guillermo Paz
Chico UI - Retreat 2011
Chico UI - Retreat 2011Chico UI - Retreat 2011
Chico UI - Retreat 2011
Guillermo Paz
Weat - Presentaci坦nWeat - Presentaci坦n
Weat - Presentaci坦n
Guillermo Paz
User FirstUser First
User First
Guillermo Paz
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]
Guillermo Paz
Decoupling your JavaScript
Decoupling your JavaScriptDecoupling your JavaScript
Decoupling your JavaScript
Guillermo Paz
HTML5: Introduction
HTML5: IntroductionHTML5: Introduction
HTML5: Introduction
Guillermo Paz
Est叩ndares Web con Chico UIEst叩ndares Web con Chico UI
Est叩ndares Web con Chico UI
Guillermo Paz
Chico UI - Retreat 2011
Chico UI - Retreat 2011Chico UI - Retreat 2011
Chico UI - Retreat 2011
Guillermo Paz
Weat - Presentaci坦nWeat - Presentaci坦n
Weat - Presentaci坦n
Guillermo Paz

Recently uploaded (20)

How to configure the retail shop in Odoo 17 Point of Sale
How to configure the retail shop in Odoo 17 Point of SaleHow to configure the retail shop in Odoo 17 Point of Sale
How to configure the retail shop in Odoo 17 Point of Sale
Celine George
2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions
leigh441292
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
Test Bank Pharmacology 3rd Edition Brenner Stevens
Test Bank Pharmacology 3rd Edition Brenner  StevensTest Bank Pharmacology 3rd Edition Brenner  Stevens
Test Bank Pharmacology 3rd Edition Brenner Stevens
evakimworwa38
PSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First TryPSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First Try
lethamcmullen
Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...
Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...
Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...
A Biodiction : A Unit of Dr. Divya Sharma
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. DabhadeCombinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
National Council of Open Schooling Research and Training
MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025
MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025
MUSIC QUIZ | THE QUIZ CLUB OF PSGCAS | 12 MARCH 2025
Quiz Club of PSG College of Arts & Science
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptxO SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
Literature Hero
How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17
Celine George
"The Write Path: Navigating Research Writing, Publication, and Professional G...
"The Write Path: Navigating Research Writing, Publication, and Professional G..."The Write Path: Navigating Research Writing, Publication, and Professional G...
"The Write Path: Navigating Research Writing, Publication, and Professional G...
neelottama
Using GenAI for Universal Design for Learning
Using GenAI for Universal Design for LearningUsing GenAI for Universal Design for Learning
Using GenAI for Universal Design for Learning
Damian T. Gordon
Research in Physical Education by Diwakar Kashyap Sir
Research in Physical Education by Diwakar Kashyap SirResearch in Physical Education by Diwakar Kashyap Sir
Research in Physical Education by Diwakar Kashyap Sir
Diwakar Kashyap
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdfIB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
Dr. Mahtab Alam
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
Code a Strategy on Pine Script With the Help of ChatGPT by Akshay Choudhary
Code a Strategy on Pine Script With the Help of ChatGPT by Akshay ChoudharyCode a Strategy on Pine Script With the Help of ChatGPT by Akshay Choudhary
Code a Strategy on Pine Script With the Help of ChatGPT by Akshay Choudhary
QuantInsti
nature and importance of Indian Knowledge System
nature and importance of Indian Knowledge Systemnature and importance of Indian Knowledge System
nature and importance of Indian Knowledge System
hanishabatra0
APM London Network: Essentials of a Good PMO, 2 April 2025
APM London Network: Essentials of a Good PMO, 2 April 2025APM London Network: Essentials of a Good PMO, 2 April 2025
APM London Network: Essentials of a Good PMO, 2 April 2025
Association for Project Management
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Sue Beckingham
How to configure the retail shop in Odoo 17 Point of Sale
How to configure the retail shop in Odoo 17 Point of SaleHow to configure the retail shop in Odoo 17 Point of Sale
How to configure the retail shop in Odoo 17 Point of Sale
Celine George
2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions2. ES: Application of Number: Units of measure & conversions
2. ES: Application of Number: Units of measure & conversions
leigh441292
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
Test Bank Pharmacology 3rd Edition Brenner Stevens
Test Bank Pharmacology 3rd Edition Brenner  StevensTest Bank Pharmacology 3rd Edition Brenner  Stevens
Test Bank Pharmacology 3rd Edition Brenner Stevens
evakimworwa38
PSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First TryPSD-I Exam Dumps: Your Key to Passing on the First Try
PSD-I Exam Dumps: Your Key to Passing on the First Try
lethamcmullen
Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...
Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...
Bioinformatics: History of Bioinformatics, Components of Bioinformatics, Geno...
A Biodiction : A Unit of Dr. Divya Sharma
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. DabhadeCombinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Combinatorial_Chemistry.pptx by Mrs. Manjushri P. Dabhade
Dabhade madam Dabhade
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptxO SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
O SWEET SPONTANEOUS BY EDWARD ESTLIN CUMMINGSAN.pptx
Literature Hero
How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17How to Invoice Shipping Cost to Customer in Odoo 17
How to Invoice Shipping Cost to Customer in Odoo 17
Celine George
"The Write Path: Navigating Research Writing, Publication, and Professional G...
"The Write Path: Navigating Research Writing, Publication, and Professional G..."The Write Path: Navigating Research Writing, Publication, and Professional G...
"The Write Path: Navigating Research Writing, Publication, and Professional G...
neelottama
Using GenAI for Universal Design for Learning
Using GenAI for Universal Design for LearningUsing GenAI for Universal Design for Learning
Using GenAI for Universal Design for Learning
Damian T. Gordon
Research in Physical Education by Diwakar Kashyap Sir
Research in Physical Education by Diwakar Kashyap SirResearch in Physical Education by Diwakar Kashyap Sir
Research in Physical Education by Diwakar Kashyap Sir
Diwakar Kashyap
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdfIB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
IB-Unit-4 BBA BVIMR 2022 Syllabus_watermark.pdf
Dr. Mahtab Alam
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
Code a Strategy on Pine Script With the Help of ChatGPT by Akshay Choudhary
Code a Strategy on Pine Script With the Help of ChatGPT by Akshay ChoudharyCode a Strategy on Pine Script With the Help of ChatGPT by Akshay Choudhary
Code a Strategy on Pine Script With the Help of ChatGPT by Akshay Choudhary
QuantInsti
nature and importance of Indian Knowledge System
nature and importance of Indian Knowledge Systemnature and importance of Indian Knowledge System
nature and importance of Indian Knowledge System
hanishabatra0
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Enhancing SoTL through Generative AI -- Opportunities and Ethical Considerati...
Sue Beckingham

JavaScript: The prototype Property