售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering JavaScript
Table of Contents
Mastering JavaScript
Credits
About the Author
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
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. JavaScript Primer
A little bit of history
How to use this book
Hello World
An overview of JavaScript
Comments
Variables
Constants
Number
String
Undefined values
Booleans
The instanceof operator
Date objects
The + operator
The ++ and -- operators
Boolean operators
Equality
Strict equality using ===
Weak equality using ==
JavaScript types
Automatic semicolon insertion
JavaScript style guide
Whitespaces
Parentheses, line breaks, and braces
Quotes
End of lines and empty lines
Type checking
Type casting
Conditional evaluation
Naming
The eval() method is evil
The strict mode
Enabling the strict mode for an existing code can break it
Package with care
Variables must be declared in strict mode
The eval() function is cleaner in strict mode
Features that are blocked in strict mode
Running JSHint
Summary
2. Functions, Closures, and Modules
A function literal
A function declaration
Functions as data
Scoping
Global scope
Local scope
Function-level scope versus block-level scope
Inline function expressions
Block scopes
Function declarations versus function expressions
The arguments parameter
The this parameter
Invocation as a function
Invocation as a method
Invocation as a constructor
Invocation using apply() and call() methods
Anonymous functions
Anonymous functions while creating an object
Anonymous functions while creating a list
Anonymous functions as a parameter to another function
Anonymous functions in conditional logic
Closures
Timers and callbacks
Private variables
Loops and closures
Modules
Stylistic considerations
Summary
3. Data Structures and Manipulation
Regular expressions
Exact match
Match from a class of characters
Repeated occurrences
Alternatives – OR
Beginning and end
Backreferences
Greedy and lazy quantifiers
Arrays
Maps
Sets
A matter of style
Summary
4. Object-Oriented JavaScript
Understanding objects
Behavior of JavaScript objects
Prototypes
Instance properties versus prototype properties
Inheritance
Getters and setters
Summary
5. JavaScript Patterns
Design patterns
The namespace pattern
The module pattern
ES6 modules
The factory pattern
The mixin pattern
The decorator pattern
The observer pattern
JavaScript Model-View-* patterns
Model-View-Controller
Models
Views
Controllers
The Model-View-Presenter pattern
Model-View-ViewModel
Summary
6. Testing and Debugging
Unit testing
Test-driven development
Behavior-driven development
JavaScript debugging
Syntax errors
Using strict
Runtime exceptions
Console.log and asserts
Chrome DevTools
Summary
7. ECMAScript 6
Shims or polyfills
Transpilers
ES6 syntax changes
Block scoping
Default parameters
Spread and rest
Destructuring
Object literals
Template literals
Maps and Sets
Symbols
Iterators
For..of loops
Arrow functions
Summary
8. DOM Manipulation and Events
DOM
Accessing DOM elements
Accessing specific nodes
Chaining
Traversal and manipulation
Working with browser events
Propagation
jQuery event handling and propagation
Event delegation
The event object
Summary
9. Server-Side JavaScript
An asynchronous evented-model in a browser
Callbacks
Timers
EventEmitters
Modules
Creating modules
npm
Installing packages
JavaScript performance
JavaScript profiling
The CPU profile
The Timeline view
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜