SlideShare a Scribd company logo
1 of 23
introducing OO
 Learning Javascript foundations


           John Hunter
         19 October 2008
what’s OO?
   Object-oriented programming
 (OOP) is a programming paradigm
that uses objects and their interactions
        to design applications
                                 source: wikipedia/Object Orientated
review
types
                   type             examples
                  String         ' Apples' quot;42quot;
primitive type




                 Number           42 3.12 -9
                 Boolean           true false
                 Object         { x: 100, y: 200 }
reference type




                  Array        [' Apples', 42, 3.12]
                 Function       function () { ... }
functions are like other types - we can
       assign them to variables

 function showMessage (msg) {
                                       declare a named function
    console.log(msg);
 }

 var showMessage = function (msg) {
                                      declare a variable and assign it
    console.log(msg);
                                         an anonymous function
 }
function showMessage (msg) {
   console.log(msg);
}

showMessage('Goodbye');

                                 create a reference to the
var showAnother = showMessage;
                                     original function
showAnother('Hello');


Goodbye
Hello
showMessage         Function




showAnother
                      call the
                       same
                     function



              showAnother('Hello');
              showMessage('Goodbye');
...now for something
 completely different
by Roadsidepictures           http://www.techlib.com/electronics/crystal.html




                      good   bad
Object-oriented programming may be seen as a
collection of cooperating objects, as opposed to a
traditional view in which a program may be seen
 as a group of tasks to compute (quot;subroutinesquot;).


Each object can be viewed as an independent little
   machine with a distinct role or responsibility.

                                         source: wikipedia/Object Orientated
radio
      1.
           volume
           frequency

           changeVolume ()
      2.
           changeTuner ()




1. properties - hold the state of an object
2. methods - provide the object with behaviour
...to the code:
the object module
var radio = {};




                  create an object literal
var radio = {

 volume: 0,

 frequency: 88.0
};




   add properties which will store the object state
var radio = {

 volume: 0,

 frequency: 88.0,


 changeVolume: function (direction) {},

 changeTuner: function (direction) {}
};




  add methods which will give the object behaviour
var radio = {
 
 volume: 0,
 
    frequency: 88.0,
 
 
    changeVolume: function (direction) {
 
    
 if (direction === 'up') this.volume += 1;
 
    
 else this.volume -= 1;
 
    },
 
    changeTuner: function (direction) {
 
      
 if (direction === 'up') this.frequency += 4;
 
    
   else this.frequency -= 4;
 
    }
 };
code the functionality that gives methods their behaviour
adjust the volume...


radio.changeVolume('up'); // volume is 1
radio.changeVolume('up'); // volume is 2
radio.changeVolume('up'); // volume is 3
radio.changeVolume('down'); // volume is 2
tune in...

radio. changeTuner('up'); // frequency is 92.0 Mhz
radio. changeTuner('up'); // frequency is 96.0 Mhz
radio. changeTuner('up'); // frequency is 100.0 Mhz
radio. changeTuner('up'); // frequency is 104.0 Mhz
radio. changeTuner('up'); // frequency is 108.0 Mhz
radio. changeTuner('down'); // frequency is 104.0 Mhz
radio
 volume
 frequency

 changeVolume ()
 changeTuner ()




models the real world object
encapsulates code in a single object
lets see some
  real code!
Review
functions, like objects, are a data type
OO approach:
  - objects have roles and interact
  - objects model the real world and are self-contained
object module:
  - an object literal containing properies and functions
  - allows you to structure code on object-oriented principles
homework!
           r own
       you
Build
            radio
     sistor
tran                    ome
                      s
                         arts
                       p
                            ed!!
                       clud
                    in
Thanks

More Related Content

What's hot (20)

Oop07 6
Oop07 6Oop07 6
Oop07 6
 
CLASSES, STRUCTURE,UNION in C++
CLASSES, STRUCTURE,UNION in C++CLASSES, STRUCTURE,UNION in C++
CLASSES, STRUCTURE,UNION in C++
 
OO in JavaScript
OO in JavaScriptOO in JavaScript
OO in JavaScript
 
ActionScript3 collection query API proposal
ActionScript3 collection query API proposalActionScript3 collection query API proposal
ActionScript3 collection query API proposal
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Farhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd YearFarhaan Ahmed, BCA 2nd Year
Farhaan Ahmed, BCA 2nd Year
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Vectors in Java
Vectors in JavaVectors in Java
Vectors in Java
 
iOS Session-2
iOS Session-2iOS Session-2
iOS Session-2
 
Built in classes in java
Built in classes in javaBuilt in classes in java
Built in classes in java
 
01 objective-c session 1
01  objective-c session 101  objective-c session 1
01 objective-c session 1
 
Introduction to c ++ part -2
Introduction to c ++   part -2Introduction to c ++   part -2
Introduction to c ++ part -2
 
JAVA CONCEPTS
JAVA CONCEPTS JAVA CONCEPTS
JAVA CONCEPTS
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objects
 
Wrapper classes
Wrapper classes Wrapper classes
Wrapper classes
 
Advanced data structures using c++ 3
Advanced data structures using c++ 3Advanced data structures using c++ 3
Advanced data structures using c++ 3
 
Lsl scripts
Lsl scriptsLsl scripts
Lsl scripts
 
Autoboxing And Unboxing In Java
Autoboxing And Unboxing In JavaAutoboxing And Unboxing In Java
Autoboxing And Unboxing In Java
 
JVM and OOPS Introduction
JVM and OOPS IntroductionJVM and OOPS Introduction
JVM and OOPS Introduction
 
JSpiders - Wrapper classes
JSpiders - Wrapper classesJSpiders - Wrapper classes
JSpiders - Wrapper classes
 

Similar to Javascript foundations: Introducing OO

Class & Object - Intro
Class & Object - IntroClass & Object - Intro
Class & Object - IntroPRN USM
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftMichele Titolo
 
K is for Kotlin
K is for KotlinK is for Kotlin
K is for KotlinTechMagic
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8Raffi Khatchadourian
 
JavaScript(Es5) Interview Questions & Answers
JavaScript(Es5)  Interview Questions & AnswersJavaScript(Es5)  Interview Questions & Answers
JavaScript(Es5) Interview Questions & AnswersRatnala Charan kumar
 
#pugMi - DDD - Value objects
#pugMi - DDD - Value objects#pugMi - DDD - Value objects
#pugMi - DDD - Value objectsSimone Gentili
 
javascript
javascript javascript
javascript Kaya Ota
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScriptDonald Sipe
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side JavascriptJulie Iskander
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2Leonid Maslov
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshowilias ahmed
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications Juliana Lucena
 
Eqela Core API and Utilities
Eqela Core API and UtilitiesEqela Core API and Utilities
Eqela Core API and Utilitiesjobandesther
 

Similar to Javascript foundations: Introducing OO (20)

Class & Object - Intro
Class & Object - IntroClass & Object - Intro
Class & Object - Intro
 
JavsScript OOP
JavsScript OOPJavsScript OOP
JavsScript OOP
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in Swift
 
K is for Kotlin
K is for KotlinK is for Kotlin
K is for Kotlin
 
Oop java
Oop javaOop java
Oop java
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 
JavaScript(Es5) Interview Questions & Answers
JavaScript(Es5)  Interview Questions & AnswersJavaScript(Es5)  Interview Questions & Answers
JavaScript(Es5) Interview Questions & Answers
 
#pugMi - DDD - Value objects
#pugMi - DDD - Value objects#pugMi - DDD - Value objects
#pugMi - DDD - Value objects
 
javascript
javascript javascript
javascript
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Classes1
Classes1Classes1
Classes1
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
 
Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications  Ember.js - A JavaScript framework for creating ambitious web applications
Ember.js - A JavaScript framework for creating ambitious web applications
 
6976.ppt
6976.ppt6976.ppt
6976.ppt
 
Eqela Core API and Utilities
Eqela Core API and UtilitiesEqela Core API and Utilities
Eqela Core API and Utilities
 
Oojs 1.1
Oojs 1.1Oojs 1.1
Oojs 1.1
 
JavaScript for real men
JavaScript for real menJavaScript for real men
JavaScript for real men
 

Recently uploaded

The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideStefan Dietze
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 

Recently uploaded (20)

The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 

Javascript foundations: Introducing OO

  • 1. introducing OO Learning Javascript foundations John Hunter 19 October 2008
  • 2. what’s OO? Object-oriented programming (OOP) is a programming paradigm that uses objects and their interactions to design applications source: wikipedia/Object Orientated
  • 4. types type examples String ' Apples' quot;42quot; primitive type Number 42 3.12 -9 Boolean true false Object { x: 100, y: 200 } reference type Array [' Apples', 42, 3.12] Function function () { ... }
  • 5. functions are like other types - we can assign them to variables function showMessage (msg) { declare a named function console.log(msg); } var showMessage = function (msg) { declare a variable and assign it console.log(msg); an anonymous function }
  • 6. function showMessage (msg) { console.log(msg); } showMessage('Goodbye'); create a reference to the var showAnother = showMessage; original function showAnother('Hello'); Goodbye Hello
  • 7. showMessage Function showAnother call the same function showAnother('Hello'); showMessage('Goodbye');
  • 8. ...now for something completely different
  • 9. by Roadsidepictures http://www.techlib.com/electronics/crystal.html good bad
  • 10. Object-oriented programming may be seen as a collection of cooperating objects, as opposed to a traditional view in which a program may be seen as a group of tasks to compute (quot;subroutinesquot;). Each object can be viewed as an independent little machine with a distinct role or responsibility. source: wikipedia/Object Orientated
  • 11. radio 1. volume frequency changeVolume () 2. changeTuner () 1. properties - hold the state of an object 2. methods - provide the object with behaviour
  • 12. ...to the code: the object module
  • 13. var radio = {}; create an object literal
  • 14. var radio = { volume: 0, frequency: 88.0 }; add properties which will store the object state
  • 15. var radio = { volume: 0, frequency: 88.0, changeVolume: function (direction) {}, changeTuner: function (direction) {} }; add methods which will give the object behaviour
  • 16. var radio = { volume: 0, frequency: 88.0, changeVolume: function (direction) { if (direction === 'up') this.volume += 1; else this.volume -= 1; }, changeTuner: function (direction) { if (direction === 'up') this.frequency += 4; else this.frequency -= 4; } }; code the functionality that gives methods their behaviour
  • 17. adjust the volume... radio.changeVolume('up'); // volume is 1 radio.changeVolume('up'); // volume is 2 radio.changeVolume('up'); // volume is 3 radio.changeVolume('down'); // volume is 2
  • 18. tune in... radio. changeTuner('up'); // frequency is 92.0 Mhz radio. changeTuner('up'); // frequency is 96.0 Mhz radio. changeTuner('up'); // frequency is 100.0 Mhz radio. changeTuner('up'); // frequency is 104.0 Mhz radio. changeTuner('up'); // frequency is 108.0 Mhz radio. changeTuner('down'); // frequency is 104.0 Mhz
  • 19. radio volume frequency changeVolume () changeTuner () models the real world object encapsulates code in a single object
  • 20. lets see some real code!
  • 21. Review functions, like objects, are a data type OO approach: - objects have roles and interact - objects model the real world and are self-contained object module: - an object literal containing properies and functions - allows you to structure code on object-oriented principles
  • 22. homework! r own you Build radio sistor tran ome s arts p ed!! clud in