SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
S O L I D
J AVA S C R I P T
C O D I N G
M A Y 2 4 , 2 0 1 5 - D I WA D E L M U N D O / V O YA G E R I N N O VA T I O N S
JavaScript is …
– C H A R L E S J O S E P H U Y
“swiss army knife romance.”
JavaScript is …
– M A . C Z A R I N A S . B O N G AT
“is a cool scripting language but hard to learn.”
JavaScript is …
– S A M U E L F R A N C I S C O
“the language to rule them all.”
JavaScript is …
- S E T A B A S E S TA N D A R D F O R
J AVA S C R I P T D E V E L O P M E N T
W H Y A R E W E H E R E ?
- F O S T E R A
C O L L A B O R AT I V E
E N V I R O N M E N T F O R
J AVA S C R I P T
K N O W L E D G E L E A R N I N G
- G E T T O G E T H E R A N D
H AV E L U N C H !
O V E R V I E W O F T O D AY ’ S S E S S I O N
• JavaScript Review - Diwa del Mundo
• Object-Oriented Programming in JS - Zander
Magtipon
• JavaScript Anti-Patterns - Russell Santos
• JS Race Conditions - Arisa Ochavez
• ECMAScript 6 - Ruel Pagayon
git clone https://goo.gl/fNA4Ex
// If you have nvm:
nvm use v0.12
node
J AVA S C R I P T R E V I E W
• Variables, Globals
• Functions (Scopes, Constructor Functions, Self-
executing)
• Object Literals and the “new” operator
• Closures
1 . VA R I A B L E S . J S
• Primitives
• typeof
2 . O B J E C T-
L I T E R A L S . J S
• You can create variables
either by literals or built-in
constructors
• Object literals: key-value
notation
• For non-custom objects,
you’ll use literals most of
the time
3 . VA R S -
G L O B A L S . J S
• Variables are declared via
‘var’, optional but
recommended
• Not using ‘var’ makes your
variable an implied global
• Implied globals can be
deleted, explicit globals
cannot be deleted
4 . N O T E S - O N - T H I S . J S
• The variable ‘this’ inside a non-constructor function points to the
global object
global
5 . H O I S T I N G . J S
• Hoisting refers to the
‘jump to top’ behaviour of
the JavaScript interpreter
• Interpreter “preprocesses”
code
6 . F U N C T I O N S . J S
• Functions are 1st-class objects in JS:
they have properties and methods
• They provide scope
• Created dynamically, assigned,
copied by reference
• Can be passed as arguments to
other functions

• Types: function declarations,
functional expression, named
functional expression
I M M E D I AT E
F U N C T I O N S A N D
C U R RY I N G
• Immediate functions
executes immediately -
good for initialisation
• Currying - partial
application of functions -
good when calling
functions with similar
arguments
N E W
7 . C O N S T R U C T O R -
F U N C T I O N S . J S
• You can create object
instances using the ‘new’
operator
• “Objects” are defined via
constructor functions
• ‘this’ refers to the instance
http://www.thehindu.com/multimedia/dynamic/00846/20SM_VIJAY_846767f.jpg
– C H A P T E R 3 , E X P E R T J AVA S C R I P T ( D A G G E T T )
A closure is the act of binding all free variables and
functions into a closed expression that persist
beyond the lexical scope from which they were
created.
8 . C L O S U R E S . J S
• Most basic definition: an
outer function that returns
an inner function
• A way to have access to
variables and functions
that it shouldn’t have
S U M M A RY
• Use literals.
• Define objects through constructor functions.
• Understand ‘this’.
• Learn functions by heart.
• Whatever happens, make sure you know closures.
Colophon
The animal in the photo in this presentation is a Tarsier.
References
See References.md
JavaScript Patterns
Expert JavaScript

Weitere ähnliche Inhalte

Ähnlich wie Solid JavaScript Coding

High quality Front-End
High quality Front-EndHigh quality Front-End
High quality Front-EndDavid Simons
 
[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...
[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...
[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...hackersuli
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at ScaleDavid Simons
 
Angular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of SpeedAngular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of SpeedIlia Idakiev
 
Elasticsearch at EyeEm
Elasticsearch at EyeEmElasticsearch at EyeEm
Elasticsearch at EyeEmLars Fronius
 
Bristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQLBristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQLDavid Simons
 
Zend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPZend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPAdam Englander
 
Ceph Day KL - Bluestore
Ceph Day KL - Bluestore Ceph Day KL - Bluestore
Ceph Day KL - Bluestore Ceph Community
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript BasicsMindfire Solutions
 
Introduction to JavaScript for Modern Software Development
Introduction to JavaScript for Modern Software DevelopmentIntroduction to JavaScript for Modern Software Development
Introduction to JavaScript for Modern Software DevelopmentKenneth Geisshirt
 
A practical look at your first laravel angular js app
A practical look at your first laravel angular js appA practical look at your first laravel angular js app
A practical look at your first laravel angular js appJohn Fischelli
 

Ähnlich wie Solid JavaScript Coding (20)

High quality Front-End
High quality Front-EndHigh quality Front-End
High quality Front-End
 
New Android Languages
New Android LanguagesNew Android Languages
New Android Languages
 
The Swift Architect
The Swift ArchitectThe Swift Architect
The Swift Architect
 
Java script core
Java script coreJava script core
Java script core
 
Witchcraft
WitchcraftWitchcraft
Witchcraft
 
[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...
[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...
[HUN][Hackersuli] Androidos alkalmazássebészet, avagy gumikesztyűt fel és irá...
 
Java 20
Java 20Java 20
Java 20
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at Scale
 
Angular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of SpeedAngular server side rendering with NodeJS - In Pursuit Of Speed
Angular server side rendering with NodeJS - In Pursuit Of Speed
 
Nodejs from zero to hero
Nodejs from zero to heroNodejs from zero to hero
Nodejs from zero to hero
 
ITB2016 - ColdBox 4 Modules
ITB2016 - ColdBox 4 ModulesITB2016 - ColdBox 4 Modules
ITB2016 - ColdBox 4 Modules
 
Elasticsearch at EyeEm
Elasticsearch at EyeEmElasticsearch at EyeEm
Elasticsearch at EyeEm
 
Bristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQLBristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQL
 
Zend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPZend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHP
 
Ceph Day KL - Bluestore
Ceph Day KL - Bluestore Ceph Day KL - Bluestore
Ceph Day KL - Bluestore
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript Basics
 
Introduction to JavaScript for Modern Software Development
Introduction to JavaScript for Modern Software DevelopmentIntroduction to JavaScript for Modern Software Development
Introduction to JavaScript for Modern Software Development
 
A practical look at your first laravel angular js app
A practical look at your first laravel angular js appA practical look at your first laravel angular js app
A practical look at your first laravel angular js app
 
RxJava@DAUG
RxJava@DAUGRxJava@DAUG
RxJava@DAUG
 

Kürzlich hochgeladen

%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 

Kürzlich hochgeladen (20)

%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

Solid JavaScript Coding

  • 1. S O L I D J AVA S C R I P T C O D I N G M A Y 2 4 , 2 0 1 5 - D I WA D E L M U N D O / V O YA G E R I N N O VA T I O N S
  • 3. – C H A R L E S J O S E P H U Y “swiss army knife romance.” JavaScript is …
  • 4. – M A . C Z A R I N A S . B O N G AT “is a cool scripting language but hard to learn.” JavaScript is …
  • 5. – S A M U E L F R A N C I S C O “the language to rule them all.” JavaScript is …
  • 6. - S E T A B A S E S TA N D A R D F O R J AVA S C R I P T D E V E L O P M E N T W H Y A R E W E H E R E ? - F O S T E R A C O L L A B O R AT I V E E N V I R O N M E N T F O R J AVA S C R I P T K N O W L E D G E L E A R N I N G - G E T T O G E T H E R A N D H AV E L U N C H !
  • 7. O V E R V I E W O F T O D AY ’ S S E S S I O N • JavaScript Review - Diwa del Mundo • Object-Oriented Programming in JS - Zander Magtipon • JavaScript Anti-Patterns - Russell Santos • JS Race Conditions - Arisa Ochavez • ECMAScript 6 - Ruel Pagayon
  • 8. git clone https://goo.gl/fNA4Ex // If you have nvm: nvm use v0.12 node
  • 9. J AVA S C R I P T R E V I E W • Variables, Globals • Functions (Scopes, Constructor Functions, Self- executing) • Object Literals and the “new” operator • Closures
  • 10. 1 . VA R I A B L E S . J S • Primitives • typeof
  • 11. 2 . O B J E C T- L I T E R A L S . J S • You can create variables either by literals or built-in constructors • Object literals: key-value notation • For non-custom objects, you’ll use literals most of the time
  • 12. 3 . VA R S - G L O B A L S . J S • Variables are declared via ‘var’, optional but recommended • Not using ‘var’ makes your variable an implied global • Implied globals can be deleted, explicit globals cannot be deleted
  • 13. 4 . N O T E S - O N - T H I S . J S • The variable ‘this’ inside a non-constructor function points to the global object global
  • 14. 5 . H O I S T I N G . J S • Hoisting refers to the ‘jump to top’ behaviour of the JavaScript interpreter • Interpreter “preprocesses” code
  • 15. 6 . F U N C T I O N S . J S • Functions are 1st-class objects in JS: they have properties and methods • They provide scope • Created dynamically, assigned, copied by reference • Can be passed as arguments to other functions
 • Types: function declarations, functional expression, named functional expression
  • 16. I M M E D I AT E F U N C T I O N S A N D C U R RY I N G • Immediate functions executes immediately - good for initialisation • Currying - partial application of functions - good when calling functions with similar arguments
  • 17. N E W
  • 18. 7 . C O N S T R U C T O R - F U N C T I O N S . J S • You can create object instances using the ‘new’ operator • “Objects” are defined via constructor functions • ‘this’ refers to the instance
  • 20. – C H A P T E R 3 , E X P E R T J AVA S C R I P T ( D A G G E T T ) A closure is the act of binding all free variables and functions into a closed expression that persist beyond the lexical scope from which they were created.
  • 21. 8 . C L O S U R E S . J S • Most basic definition: an outer function that returns an inner function • A way to have access to variables and functions that it shouldn’t have
  • 22. S U M M A RY • Use literals. • Define objects through constructor functions. • Understand ‘this’. • Learn functions by heart. • Whatever happens, make sure you know closures.
  • 23. Colophon The animal in the photo in this presentation is a Tarsier. References See References.md JavaScript Patterns Expert JavaScript