Object-Oriented JavaScript
eBook - ePub

Object-Oriented JavaScript

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

Stoyan Stefanov

Condividi libro
  1. 356 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Object-Oriented JavaScript

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

Stoyan Stefanov

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

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.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Object-Oriented JavaScript è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Object-Oriented JavaScript di Stoyan Stefanov in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatica e Tecnologia dell'informazione. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
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...

Indice dei contenuti