Object-Oriented JavaScript
eBook - ePub

Object-Oriented JavaScript

Create scalable, reusable high-quality JavaScript applications, and libraries

Stoyan Stefanov

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

Object-Oriented JavaScript

Create scalable, reusable high-quality JavaScript applications, and libraries

Stoyan Stefanov

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

À propos de ce livre

In Detail

Once listed in the "nice to have" sections of job postings, these days the knowledge of JavaScript is a deciding factor when it comes to hiring web developers. And rightly so. Where in the past we used to have the occasional few lines of JavaScript embedded in a web page, now we have advanced libraries and extensible architectures, powering the "fat-client", AJAX-type rich internet applications.

JavaScript is the language of the browser, but it's also heavily employed in many other environments: server-side programming, desktop applications, application extensions and widgets. It's a pretty good deal: you learn one language and then code all kinds of different applications. While this book has one chapter specifically dedicated to the web browser environment including DOM, events, and AJAX tutorials, the rest is applicable to all the other environments too. 

This book treats JavaScript as a serious object-oriented language, showing you how to build robust, maintainable, and powerful libraries and applications. Along the way, we cover many of the recent innovations such as AJAX, JSON, and interesting design and coding patterns. After reading this book, you'll be prepared to ace your JavaScript job interview and even impress with some bits that the interviewer maybe didn't know. You should read this book if you want to be able to take your JavaScript skills to a new level of sophistication.

Create scalable and reusable high-quality JavaScript applications and libraries using the concepts of object-oriented programming

Who this book is for

The book requires no prior knowledge of JavaScript and works from the ground up to give you a thorough grounding in this powerful language. If you do already know some JavaScript, you will find plenty of eye-openers as you discover just what the language can do.

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 review what you have learned.

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 est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Object-Oriented JavaScript par Stoyan Stefanov en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatica et Tecnologia dell'informazione. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2008
ISBN
9781847194145

Object-Oriented JavaScript

Create scalable, reusable high-quality JavaScript applications, and libraries

Stoyan Stefanov


Table of Contents

Object-Oriented JavaScript
Credits
About the Author
About the Reviewers
Preface
What This Book Covers
Conventions
Reader Feedback
Customer Support
Errata
Questions
1. Introduction
A Bit of History
The Winds of Change
The Present
The Future
Object-Oriented Programming
Objects
Classes
Encapsulation
Aggregation
Inheritance
Polymorphism
OOP Summary
Setting up Your Training Environment
Getting the Tools You Need
Using the Firebug Console
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
Code Blocks
if Conditions
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
Pre-defined Functions
parseInt()
parseFloat()
isNaN()
isFinite()
Encode/Decode URIs
eval()
A Bonus—the alert() Function
Scope of Variables
Functions are Data
A nonymous Functions
C allback Functions
C allback Examples
Self-invoking Functions
Inner (Private) Functions
Functions that Return Functions
Function, Rewrite Thyself!
Closures
Scope Chain
Lexical Scope
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
Hashes, Associative Arrays
Accessing Object's Properties
Calling an Object's Methods
Altering Properties/Methods
Using this Value
Constructor Functions
The Global Object
constructor Property
instanceof Operator
Functions that Return Objects
Passing Objects
Comparing Objects
Objects in the Firebug Console
Built-in Objects
Object
Array
Interesting Array Methods
Function
Properties of the Function Objects
Methods of the Function Objects
The arguments Object Revisited
Boolean
Number
String
Interesting Methods of the String Objects
Math
Date
Methods to Work with Date Objects
RegExp
Properties of the RegExp Objects
Methods of the RegExp Objects
String Methods that Accept Regular Expressions as Parameters
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 Prototype's Property with Own Property
Enumerating Properties
isPrototypeOf()
The Secret __proto__ Link
Augmenting Built-in Objects
Augmenting Built-in Objects—Discussion
Some 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 Overv...

Table des matiĂšres