Object-Oriented JavaScript - Second Edition
eBook - ePub

Object-Oriented JavaScript - Second Edition

Stoyan Stefanov, Kumar Chetan Sharma

Partager le livre
  1. 382 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Object-Oriented JavaScript - Second Edition

Stoyan Stefanov, Kumar Chetan Sharma

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

You will first be introduced to object-oriented programming, then to the basics of objects in JavaScript. This book takes a do-it-yourself approach when it comes to writing code, because the best way to really learn a programming language is by writing code. You are encouraged to type code into Firebug's console, see how it works and then tweak it and play around with it. There are practice questions at the end of each chapter to help you review what you have learned.For new to intermediate JavaScript developer who wants to prepare themselves for web development problems solved by smart JavaScript!

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Object-Oriented JavaScript - Second Edition est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Object-Oriented JavaScript - Second Edition par Stoyan Stefanov, Kumar Chetan Sharma en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Object Oriented Programming. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2013
ISBN
9781849693134

Object-Oriented JavaScript Second Edition


Table of Contents

Object-Oriented JavaScript Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Object-oriented JavaScript
A bit of history
Browser wars and renaissance
The present
The future
ECMAScript 5
Object-oriented programming
Objects
Classes
Encapsulation
Aggregation
Inheritance
Polymorphism
OOP summary
Setting up your training environment
WebKit's Web Inspector
JavaScriptCore on a Mac
More consoles
Summary
2. Primitive Data Types, Arrays, Loops, and Conditions
Variables
Variables are case sensitive
Operators
Primitive data types
Finding out the value type – the typeof operator
Numbers
Octal and hexadecimal numbers
Exponent literals
Infinity
NaN
Strings
String conversions
Special strings
Booleans
Logical operators
Operator precedence
Lazy evaluation
Comparison
Undefined and null
Primitive data types recap
Arrays
Adding/updating array elements
Deleting elements
Arrays of arrays
Conditions and loops
The if condition
The else clause
Code blocks
Checking if a variable exists
Alternative if syntax
Switch
Loops
While loops
Do-while loops
For loops
For-in loops
Comments
Summary
Exercises
3. Functions
What is a function?
Calling a function
Parameters
Predefined functions
parseInt()
parseFloat()
isNaN()
isFinite()
Encode/decode URIs
eval()
A bonus – the alert() function
Scope of variables
Variable hoisting
Functions are data
Anonymous functions
Callback functions
Callback examples
Immediate functions
Inner (private) functions
Functions that return functions
Function, rewrite thyself!
Closures
Scope chain
Breaking the chain with a closure
Closure #1
Closure #2
A definition and closure #3
Closures in a loop
Getter/setter
Iterator
Summary
Exercises
4. Objects
From arrays to objects
Elements, properties, methods, and members
Hashes and associative arrays
Accessing an object's properties
Calling an object's methods
Altering properties/methods
Using the this value
Constructor functions
The global object
The constructor property
The instanceof operator
Functions that return objects
Passing objects
Comparing objects
Objects in the WebKit console
console.log
Built-in objects
Object
Array
A few array methods
Function
Properties of function objects
Prototype
Methods of function objects
Call and apply
The arguments object revisited
Inferring object types
Boolean
Number
String
A few methods of string objects
Math
Date
Methods to work with date objects
Calculating birthdays
RegExp
Properties of RegExp objects
Methods of RegExp objects
String methods that accept regular expressions as arguments
search() and match()
replace()
Replace callbacks
split()
Passing a string when a RegExp is expected
Error objects
Summary
Exercises
5. Prototype
The prototype property
Adding methods and properties using the prototype
Using the prototype's methods and properties
Own properties versus prototype properties
Overwriting a prototype's property with an own property
Enumerating properties
isPrototypeOf()
The secret __proto__ link
Augmenting built-in objects
Augmenting built-in objects – discussion
Prototype gotchas
Summary
Exercises
6. Inheritance
Prototype chaining
Prototype chaining example
Moving shared properties to the prototype
Inheriting the prototype only
A temporary constructor – new F()
Uber – access to the parent from a child object
Isolating the inheritance part into a function
Copying properties
Heads-up when copying by reference
Objects inherit from objects
Deep copy
object()
Using a mix of prototypal inheritance and copying properties
Multiple inheritance
Mixins
Parasitic inheritance
Borrowing a constructor
Borrow a constructor and copy its prototype
Summary
Case study – drawing shapes
Analysis
Implementation
Testing
Exercises
7. The Browser Environment
Including JavaScript in an HTML page
BOM and DOM – an overview
BOM
The window object revisited
window.navigator
Your console is a cheat sheet
window.location
window.history
win...

Table des matiĂšres