SlideServe
Menu
Préférences
© SlideServe · v2026

JavaScript Deep Dive

jody avatar
12 diapositives · 311 Views · Aug 06, 2014

JavaScript Deep Dive. This might stin g a little…. Jason Offutt Software Engineer Central Christian Church Email: jason.offutt@centralaz.com Twitter: @ jasonoffutt. Understanding ‘this’. To understand ‘this’, we need to start with understanding function invocation Calling a function

JavaScript Deep Dive - slide 1
01 / 12JavaScript Deep Dive
1 / 17

Télécharger la présentation

JavaScript Deep Dive
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. JavaScript Deep Dive This might sting a little… Jason Offutt Software Engineer Central Christian Church Email: jason.offutt@centralaz.com Twitter: @jasonoffutt

  2. Understanding ‘this’ • To understand ‘this’, we need to start with understanding function invocation • Calling a function • Accessing a function’s value • As a set of instructions

  3. Function call shorthand • The function primitive actually has ‘call’ and ‘apply’ methods • Allows you to directly manipulate the contextual value of ‘this’

  4. Closures & Scope Stay with me here…

  5. Block Scope? Nope • Code blocks (e.g. – if, while, for, switch, etc) have no scope • Only functions provide scope

  6. Lexical Scope? Yep • A fancy way of describing the physical placement of a function within written source code • The scope of the containing function gets associated with variables, etc

  7. Closures • A closure is a reference to a function • One is created every time you declare a function • Variable values and surrounding context are bound by reference to the function • They are not immediately deallocated from memory when they lose scope

  8. How is any of this useful? • Write clean/reusable JavaScript • Ensure your code won’t break other modules • Avoid shooting yourself in the foot

  9. Namespacing • Building off of closures • Allows you to keep your code more modular • Adds additional ways to avoid collisions with external code

  10. Popular approaches • Global Object • Singleton • Cascading

  11. Prototypes • Prototypes provide hooks into the JavaScript object model • Allow you to create and override instance methods and properties on objects

  12. Questions? • For a copy of these slides, my notes and code samples, head over to Github: • https://github.com/JasonOffutt/RefreshCache2011