SlideShare a Scribd company logo
1 of 10
Download to read offline
Programación Orientada a Objetos 
para programadores JS 
Germán Escobar 
germanescobar.net! 
@germanescobar! 
!
makeitreal .camp Objeto literal 
var todo_item1 = { 
airline: “Oceanic”, 
done: false 
}
makeitreal .camp Función constructora 
function TodoItem(title) { 
this.title = title; 
this.done = false; 
! 
this.save = function 
} 
var ti1 = new TodoItem(“Mercado”); 
! 
var ti2 = new TodoItem(“Tareas”);
makeitreal .camp Prototype 
En JavaScript no existe el concepto de 
clase. 
JavaScript es basado en prototipos.
makeitreal .camp Prototype 
function TodoItem(title) { … } 
var t1 = new TodoItem(“Mercado”); 
var t2 = new TodoItem(“Tareas”); 
! 
TodoItem.prototype.save = function() { 
console.log(“saving” + this.title); 
} 
! 
t1.save();
makeitreal .camp Prototype 
TodoItem.prototype 
• save() 
t1 (object) 
• title 
• done 
prototype 
Object.prototype 
prototype
makeitreal .camp Taller - Parte 1 
var t1 = new TodoItem(“Mercado”); 
var t2 = new TodoItem(“Tareas”); 
! 
t1.done = true 
t1.save(); 
! 
t2.save(); 
t2.destroy();
makeitreal .camp Las funciones son objetos 
function TodoItem(title) { … } 
! 
TodoItem.find = function(id) { … } 
! 
var t1 = TodoItem.find(1); 
alert(t1.title); 
alert(t1.done);
makeitreal .camp Taller - Parte2
makeitreal .camp Callbacks 
:)

More Related Content

Viewers also liked

AgilOne Email Edition
AgilOne Email EditionAgilOne Email Edition
AgilOne Email EditionAgilOne
 
AgilOne Digital Edition
AgilOne Digital EditionAgilOne Digital Edition
AgilOne Digital EditionAgilOne
 
Case Studies: Turning Browsers into Buyers
Case Studies: Turning Browsers into BuyersCase Studies: Turning Browsers into Buyers
Case Studies: Turning Browsers into BuyersAgilOne
 
AgilOne Enterprise Edition
AgilOne Enterprise EditionAgilOne Enterprise Edition
AgilOne Enterprise EditionAgilOne
 
2014 data driven marketing predictions
2014 data driven marketing predictions2014 data driven marketing predictions
2014 data driven marketing predictionsAgilOne
 
How to enhance direct mail results
How to enhance direct mail resultsHow to enhance direct mail results
How to enhance direct mail resultsAgilOne
 
Tutorial: Customer Clustering 101
Tutorial: Customer Clustering 101Tutorial: Customer Clustering 101
Tutorial: Customer Clustering 101AgilOne
 
What to do with the data?
What to do with the data?What to do with the data?
What to do with the data?AgilOne
 
Information Security and Corporate Risk
Information Security and Corporate RiskInformation Security and Corporate Risk
Information Security and Corporate RiskAgilOne
 
Bridging The Gap Between Online and Offline
Bridging The Gap Between Online and OfflineBridging The Gap Between Online and Offline
Bridging The Gap Between Online and OfflineAgilOne
 
Technology marketing for customer engagement
Technology marketing for customer engagementTechnology marketing for customer engagement
Technology marketing for customer engagementPam Morton
 

Viewers also liked (11)

AgilOne Email Edition
AgilOne Email EditionAgilOne Email Edition
AgilOne Email Edition
 
AgilOne Digital Edition
AgilOne Digital EditionAgilOne Digital Edition
AgilOne Digital Edition
 
Case Studies: Turning Browsers into Buyers
Case Studies: Turning Browsers into BuyersCase Studies: Turning Browsers into Buyers
Case Studies: Turning Browsers into Buyers
 
AgilOne Enterprise Edition
AgilOne Enterprise EditionAgilOne Enterprise Edition
AgilOne Enterprise Edition
 
2014 data driven marketing predictions
2014 data driven marketing predictions2014 data driven marketing predictions
2014 data driven marketing predictions
 
How to enhance direct mail results
How to enhance direct mail resultsHow to enhance direct mail results
How to enhance direct mail results
 
Tutorial: Customer Clustering 101
Tutorial: Customer Clustering 101Tutorial: Customer Clustering 101
Tutorial: Customer Clustering 101
 
What to do with the data?
What to do with the data?What to do with the data?
What to do with the data?
 
Information Security and Corporate Risk
Information Security and Corporate RiskInformation Security and Corporate Risk
Information Security and Corporate Risk
 
Bridging The Gap Between Online and Offline
Bridging The Gap Between Online and OfflineBridging The Gap Between Online and Offline
Bridging The Gap Between Online and Offline
 
Technology marketing for customer engagement
Technology marketing for customer engagementTechnology marketing for customer engagement
Technology marketing for customer engagement
 

Similar to JavaScript OOP Workshop

Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Alberto Naranjo
 
Java script object model
Java script object modelJava script object model
Java script object modelJames Hsieh
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript WidgetsKonstantin Käfer
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Librariesjeresig
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingHoat Le
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScriptMichael Girouard
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsZohar Arad
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?Christophe Porteneuve
 
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 JavascriptMassimo Franciosa
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to JavascriptAmit Tyagi
 
[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 - publicKazunori Tatsuki
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9Marcus Lagergren
 

Similar to JavaScript OOP Workshop (20)

Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.
 
Java script object model
Java script object modelJava script object model
Java script object model
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
 
Javascript - Beyond-jQuery
Javascript - Beyond-jQueryJavascript - Beyond-jQuery
Javascript - Beyond-jQuery
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
 
Bottom Up
Bottom UpBottom Up
Bottom Up
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?
 
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
 
17javascript.ppt
17javascript.ppt17javascript.ppt
17javascript.ppt
 
17javascript.ppt
17javascript.ppt17javascript.ppt
17javascript.ppt
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to 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
 
Oojs 1.1
Oojs 1.1Oojs 1.1
Oojs 1.1
 
oojs
oojsoojs
oojs
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9
 
V8
V8V8
V8
 

Recently uploaded

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 

Recently uploaded (20)

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 

JavaScript OOP Workshop

  • 1. Programación Orientada a Objetos para programadores JS Germán Escobar germanescobar.net! @germanescobar! !
  • 2. makeitreal .camp Objeto literal var todo_item1 = { airline: “Oceanic”, done: false }
  • 3. makeitreal .camp Función constructora function TodoItem(title) { this.title = title; this.done = false; ! this.save = function } var ti1 = new TodoItem(“Mercado”); ! var ti2 = new TodoItem(“Tareas”);
  • 4. makeitreal .camp Prototype En JavaScript no existe el concepto de clase. JavaScript es basado en prototipos.
  • 5. makeitreal .camp Prototype function TodoItem(title) { … } var t1 = new TodoItem(“Mercado”); var t2 = new TodoItem(“Tareas”); ! TodoItem.prototype.save = function() { console.log(“saving” + this.title); } ! t1.save();
  • 6. makeitreal .camp Prototype TodoItem.prototype • save() t1 (object) • title • done prototype Object.prototype prototype
  • 7. makeitreal .camp Taller - Parte 1 var t1 = new TodoItem(“Mercado”); var t2 = new TodoItem(“Tareas”); ! t1.done = true t1.save(); ! t2.save(); t2.destroy();
  • 8. makeitreal .camp Las funciones son objetos function TodoItem(title) { … } ! TodoItem.find = function(id) { … } ! var t1 = TodoItem.find(1); alert(t1.title); alert(t1.done);