
Learning JavaScript
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
This is an exciting time to learn JavaScript. Now that the latest JavaScript specification?ECMAScript 6.0 (ES6)?has been finalized, learning how to develop high-quality applications with this language is easier and more satisfying than ever. This practical book takes programmers (amateurs and pros alike) on a no-nonsense tour of ES6, along with some related tools and techniques.
Author Ethan Brown (Web Development with Node and Express) not only guides you through simple and straightforward topics (variables, control flow, arrays), but also covers complex concepts such as functional and asynchronous programming. You'll learn how to create powerful and responsive web applications on the client, or with Node.js on the server.
- Use ES6 today and transcompile code to portable ES5
- Translate data into a format that JavaScript can use
- Understand the basic usage and mechanics of JavaScript functions
- Explore objects and object-oriented programming
- Tackle new concepts such as iterators, generators, and proxies
- Grasp the complexities of asynchronous programming
- Work with the Document Object Model for browser-based apps
- Learn Node.js fundamentals for developing server-side applications
More details
Other editions
Additional editions

Content
- Cover
- Copyright
- Table of Contents
- Preface
- A Brief History of JavaScript
- ES6
- Who This Book Is For
- What This Book Is Not
- Conventions Used in This Book
- O'Reilly Safari
- How to Contact Us
- Acknowledgments
- Chapter 1. Your First Application
- Where to Start
- The Tools
- A Comment on Comments
- Getting Started
- The JavaScript Console
- Drawing Graphics Primitives
- Automating Repetitive Tasks
- Handling User Input
- Hello, World
- Chapter 2. JavaScript Development
- Prerequisites
- Your Project Root
- What Are You Trying to Do?
- Node Applications
- Installing Node
- Running JavaScript Programs with Node
- Package Management: npm
- Web Applications
- Linting
- Conclusion
- Chapter 3. Literals, Variables, Constants, and Data Types
- Variables and Constants
- Variables or Constants: Which to Use?
- Identifier Names
- Literals
- Primitive Types and Objects
- Numbers
- Strings
- Escaping
- Special Characters
- Template Strings
- Multiline Strings
- Numbers as Strings
- Booleans
- Symbols
- null and undefined
- Objects
- Number, String, and Boolean Objects
- Arrays
- Trailing Commas in Objects and Arrays
- Dates
- Regular Expressions
- Maps and Sets
- Data Type Conversion
- Converting to Numbers
- Converting to String
- Converting to Boolean
- Conclusion
- Chapter 4. Control Flow
- A Control Flow Primer
- while Loops
- Block Statements
- Whitespace
- Helper Functions
- if.else Statement
- do.while Loop
- for Loop
- if Statement
- Putting It All Together
- Control Flow Statements in JavaScript
- Control Flow Exceptions
- Chaining if...else Statements
- Metasyntax
- Additional for Loop Patterns
- switch Statements
- for...in loop
- for...of loop
- Useful Control Flow Patterns
- Using continue to Reduce Conditional Nesting
- Using break or return to Avoid Unnecessary Computation
- Using Value of Index After Loop Completion
- Using Descending Indexes When Modifying Lists
- Conclusion
- Chapter 5. Expressions and Operators
- Operators
- Arithmetic Operators
- Operator Precedence
- Comparison Operators
- Comparing Numbers
- String Concatenation
- Logical Operators
- Truthy and Falsy Values
- AND, OR, and NOT
- Short-Circuit Evaluation
- Logical Operators with Nonboolean Operands
- Conditional Operator
- Comma Operator
- Grouping Operator
- Bitwise Operators
- typeof Operator
- void Operator
- Assignment Operators
- Destructuring Assignment
- Object and Array Operators
- Expressions in Template Strings
- Expressions and Control Flow Patterns
- Converting if...else Statements to Conditional Expressions
- Converting if Statements to Short-Circuited Logical OR Expressions
- Conclusion
- Chapter 6. Functions
- Return Values
- Calling Versus Referencing
- Function Arguments
- Do Arguments Make the Function?
- Destructuring Arguments
- Default Arguments
- Functions as Properties of Objects
- The this Keyword
- Function Expressions and Anonymous Functions
- Arrow Notation
- call, apply, and bind
- Conclusion
- Chapter 7. Scope
- Scope Versus Existence
- Lexical Versus Dynamic Scoping
- Global Scope
- Block Scope
- Variable Masking
- Functions, Closures, and Lexical Scope
- Immediately Invoked Function Expressions
- Function Scope and Hoisting
- Function Hoisting
- The Temporal Dead Zone
- Strict Mode
- Conclusion
- Chapter 8. Arrays and Array Processing
- A Review of Arrays
- Array Content Manipulation
- Adding or Removing Single Elements at the Beginning or End
- Adding Multiple Elements at the End
- Getting a Subarray
- Adding or Removing Elements at Any Position
- Cutting and Replacing Within an Array
- Filling an Array with a Specific Value
- Reversing and Sorting Arrays
- Array Searching
- The Fundamental Array Operations: map and filter
- Array Magic: reduce
- Array Methods and Deleted or Never-Defined Elements
- String Joining
- Conclusion
- Chapter 9. Objects and Object-Oriented Programming
- Property Enumeration
- for...in
- Object.keys
- Object-Oriented Programming
- Class and Instance Creation
- Dynamic Properties
- Classes Are Functions
- The Prototype
- Static Methods
- Inheritance
- Polymorphism
- Enumerating Object Properties, Revisited
- String Representation
- Multiple Inheritance, Mixins, and Interfaces
- Conclusion
- Chapter 10. Maps and Sets
- Maps
- Weak Maps
- Sets
- Weak Sets
- Breaking the Object Habit
- Chapter 11. Exceptions and Error Handling
- The Error Object
- Exception Handling with try and catch
- Throwing Errors
- Exception Handling and the Call Stack
- try...catch...finally
- Let Exceptions Be Exceptional
- Chapter 12. Iterators and Generators
- The Iteration Protocol
- Generators
- yield Expressions and Two-Way Communication
- Generators and return
- Conclusion
- Chapter 13. Functions and the Power of Abstract Thinking
- Functions as Subroutines
- Functions as Subroutines That Return a Value
- Functions as.Functions
- So What?
- Functions Are Objects
- IIFEs and Asynchronous Code
- Function Variables
- Functions in an Array
- Pass a Function into a Function
- Return a Function from a Function
- Recursion
- Conclusion
- Chapter 14. Asynchronous Programming
- The Analogy
- Callbacks
- setInterval and clearInterval
- Scope and Asynchronous Execution
- Error-First Callbacks
- Callback Hell
- Promises
- Creating Promises
- Using Promises
- Events
- Promise Chaining
- Preventing Unsettled Promises
- Generators
- One Step Forward and Two Steps Back?
- Don't Write Your Own Generator Runner
- Exception Handling in Generator Runners
- Conclusion
- Chapter 15. Date and Time
- Dates, Time Zones, Timestamps, and the Unix Epoch
- Constructing Date Objects
- Moment.js
- A Practical Approach to Dates in JavaScript
- Constructing Dates
- Constructing Dates on the Server
- Constructing Dates in the Browser
- Transmitting Dates
- Displaying Dates
- Date Components
- Comparing Dates
- Date Arithmetic
- User-Friendly Relative Dates
- Conclusion
- Chapter 16. Math
- Formatting Numbers
- Fixed Decimals
- Exponential Notation
- Fixed Precision
- Different Bases
- Advanced Number Formatting
- Constants
- Algebraic Functions
- Exponentiation
- Logarithmic Functions
- Miscellaneous
- Pseudorandom Number Generation
- Trigonometric Functions
- Hyperbolic Functions
- Chapter 17. Regular Expressions
- Substring Matching and Replacing
- Constructing Regular Expressions
- Searching with Regular Expressions
- Replacing with Regular Expressions
- Input Consumption
- Alternation
- Matching HTML
- Character Sets
- Named Character Sets
- Repetition
- The Period Metacharacter and Escaping
- A True Wildcard
- Grouping
- Lazy Matches, Greedy Matches
- Backreferences
- Replacing Groups
- Function Replacements
- Anchoring
- Word Boundary Matching
- Lookaheads
- Constructing Regexes Dynamically
- Conclusion
- Chapter 18. JavaScript in the Browser
- The Document Object Model
- Some Tree Terminology
- DOM "Get" Methods
- Querying DOM Elements
- Manipulating DOM Elements
- Creating New DOM Elements
- Styling Elements
- Data Attributes
- Events
- Event Capturing and Bubbling
- Event Categories
- Ajax
- Conclusion
- Chapter 19. Node
- Node Fundamentals
- Modules
- Core Modules, File Modules, and npm Modules
- Customizing Modules with Function Modules
- Filesystem Access
- Process
- Operating System
- Child Processes
- Streams
- Web Servers
- Conclusion
- Chapter 20. Object Property Configuration and Proxies
- Accessor Properties: Getters and Setters
- Object Property Attributes
- Protecting Objects: Freezing, Sealing, and Preventing Extension
- Proxies
- Conclusion
- Chapter 21. Additional Resources
- Online Documentation
- Periodicals
- Blogs and Tutorials
- Stack Overflow
- Contributing to Open Source Projects
- Conclusion
- Appendix A. The Terminal
- Appendix B. Version Control with Git
- Installing Git
- Using Git
- Appendix C. Reserved Words
- Appendix D. Operator Precedence
- Index
- About the Author
- Colophon
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.