Book description
Develop your JavaScript programming skills by learning strategies and techniques commonly used in modern full-stack application development
Key Features
- Write and deploy full-stack applications efficiently with JavaScript
- Delve into JavaScript's multiple programming paradigms
- Get up to speed with core concepts such as modularity and functional programming to write efficient code
Book Description
In depth knowledge of JavaScript makes it easier to learn a variety of other frameworks, including React, Angular, and related tools and libraries. This book is designed to help you cover the core JavaScript concepts you need to build modern applications.
You'll start by learning how to represent an HTML document in the Document Object Model (DOM). Then, you'll combine your knowledge of the DOM and Node.js to create a web scraper for practical situations. As you read through further lessons, you'll create a Node.js-based RESTful API using the Express library for Node.js. You'll also understand how modular designs can be used for better reusability and collaboration with multiple developers on a single project. Later lessons will guide you through building unit tests, which ensure that the core functionality of your program is not affected over time. The book will also demonstrate how constructors, async/await, and events can load your applications quickly and efficiently. Finally, you'll gain useful insights into functional programming concepts such as immutability, pure functions, and higher-order functions.
By the end of this book, you'll have the skills you need to tackle any real-world JavaScript development problem using a modern JavaScript approach, both for the client and server sides.
What you will learn
- Apply the core concepts of functional programming
- Build a Node.js project that uses the Express.js library to host an API
- Create unit tests for a Node.js project to validate it
- Use the Cheerio library with Node.js to create a basic web scraper
- Develop a React interface to build processing flows
- Use callbacks as a basic way to bring control back
Who this book is for
If you want to advance from being a frontend developer to a full-stack developer and learn how Node.js can be used for hosting full-stack applications, this is an ideal book for you. After reading this book, you'll be able to write better JavaScript code and learn about the latest trends in the language. To easily grasp the concepts explained here, you should know the basic syntax of JavaScript and should've worked with popular frontend libraries such as jQuery. You should have also used JavaScript with HTML and CSS but not necessarily Node.js.
Table of contents
- Preface
- Chapter 1
-
JavaScript, HTML, and the DOM
- Introduction
- HTML and the DOM
-
Developer Tools
- Exercise 2: Manipulating the DOM from the Elements Tab
- Exercise 3: Debugging Code from the Sources Tab
- The Console Tab
- Activity 1: Extracting Data from a Page
- Nodes and Elements
- Exercise 4: Traversing the DOM Tree
- Special Objects
- Using JavaScript to Query the DOM
- Exercise 5: Querying the DOM Using querySelector
- Manipulating the DOM
- Exercise 6: Filtering and Searching Products
- Shadow DOM and Web Components
- Exercise 7: Replacing a Search Box with a Web Component
- Activity 2: Replacing the Tag Filter with a Web Component
- Summary
- Chapter 2
- Node.js and npm
- Chapter 3
- Node.js APIs and Web Scraping
- Chapter 4
- RESTful APIs with Node.js
- Chapter 5
- Modular JavaScript
- Chapter 6
- Code Quality
- Chapter 7
-
Advanced JavaScript
- Introduction
-
Language Features Supported in ES5, ES6, ES7, ES8, and ES9
- Working in the Node.js REPL
- Executing the Node.js REPL
- Array Manipulation in JavaScript
- Exercise 37: Creating and Modifying an Array
- Exercise 38: Adding and Removing Items
- Exercise 39: Getting Information About the Items in Your Array
- Activity 8: Creating a User Tracker
- Object Manipulation in JavaScript
- Exercise 40: Creating and Modifying Objects in JavaScript
- JSON.stringify
- Exercise 41: Creating an Efficient JSON.Stringify
- Array and Object Destructuring
- Exercise 42: Using Destructuring Assignment for an Array
- Exercise 43: Using Destructuring Assignment for an Object
- Spread Operators
- Exercise 44: Using Spread Operators
- Rest Operators
-
OOP in JavaScript
- Defining a Class in JavaScript
- Exercise 45: Declaring an Object Constructor Using Functions
- Exercise 46: Creating a Class in JavaScript
- Creating a Simple User Information Cache Using Objects
- Exercise 47: Creating a Cache Class to Add/Update/Remove Records from the Data Store
- Class Inheritance
- Exercise 48: Implementing a Subclass
- Private and Public Methods
- Exercise 49: Private Methods in the Vehicle Class
- Array and Object Built-in Methods
- Exercise 50: Using Iteration Methods on Arrays
- Exercise 51: Lookups and Filtering the Array
- Sorting
- Maps and Sets
- Math, Date, and String
- Symbols, Iterators, Generators, and Proxies
- Summary
- Chapter 8
- Asynchronous Programming
- Chapter 9
-
Event-Driven Programming and Built-In Modules
- Introduction
- The Traditional Approach versus Event-Driven Programming
-
Eventing
- Exercise 67: A Simple Event Emitter
- EventEmitter Methods
- Removing Listeners
- Removing all Listeners
- Attaching a One-Time Listener
- Reading from Event Emitters
- Getting a List of Events That Have Listeners Registered
- Max Listeners
- Prepend Listeners
- Concurrency in Listeners
- Building Custom Event Emitters
- Exercise 68: Building A Chatroom Application
- Activity 13: Building an Event-Driven Module
- Event-Driven Programming Best Practices
- Node.js Built-In Modules
- Handling Large Files in Node.js
- Summary
- Chapter 10
-
Functional Programming with JavaScript
- Introduction
-
Functions – First-Class Citizens
- First-Class Functions – Idiomatic JavaScript Building Blocks
- Inversion of Control Using First-Class Functions
- Functions that Enable Asynchronous I/O and Event-Driven Programming in JavaScript
- JavaScript Built-In Array Methods that Showcase First-Class Function Support
- Exercise 70: Re-Implementing includes, indexOf, and join with some, findIndex, and reduce
- Exercise 71: Computing the Price of a Basket Using Map and Reduce
- Child-Parent Component Communication in React
- Activity 15: onCheckout Callback Prop
- Exercise 72: Adding a Product to the Basket
- First-Class Functions in React Render Props
- Exercise 73: Rendering Basket Contents with a Render Prop
- Pure Functions
- Higher-Order Functions
- Function Composition
-
Immutability and Side Effects
- A Look at Redux Action Creators
- Exercise 79: Refactoring the React/Redux Application to Use Action Creators
- React-Redux mapStateToProps and mapDispatchToProps
- Exercise 80: Abstracting State Management Using the mapDispatchToProps Function
- Redux Reducers In Depth
- Changing JavaScript-Native Methods to an Immutable Functional Style
- Handling Side Effects in a React/Redux Application React Life Cycle Hooks
- Handling Side Effects in a React/Redux Application React Hooks
- Handling Side Effects in a React/Redux Application Redux-Thunk
- Introduction to GraphQL Language Schemas and Queries
- Summary
-
Appendix
- Chapter 1: JavaScript, HTML, and the DOM
- Chapter 2: Node.js and npm
- Chapter 3: Node.js APIs and Web Scraping
- Chapter 4: RESTful APIs with Node.js
- Chapter 5: Modular JavaScript
- Chapter 6: Code Quality
- Chapter 7: Advanced JavaScript
- Chapter 8: Asynchronous Programming
- Chapter 9: Event-Driven Programming and Built-In Modules
- Chapter 10: Functional Programming with JavaScript
Product information
- Title: Professional JavaScript
- Author(s):
- Release date: September 2019
- Publisher(s): Packt Publishing
- ISBN: 9781838820213
You might also like
book
Speaking JavaScript
Like it or not, JavaScript is everywhere these days—from browser to server to mobile—and now you, …
book
Mastering JavaScript
Explore and master modern JavaScript techniques in order to build large-scale web applications About This Book …
book
JavaScript
All of JavaScript's newest features, in depth, made easy to understand. JavaScript is a rapidly changing …
book
6 JavaScript Projects
There's no doubt that the JavaScript ecosystem changes fast. Not only are new tools and frameworks …