Preface
About
This section briefly introduces the author, the coverage of this book, the technical skills you'll need to get started, and the hardware and software required to complete all of the included activities and exercises.
About the Book
JavaScript is a core programming language for web technology that can be used to modify both HTML and CSS. It is frequently abbreviated to just JS. JavaScript is used for processes that go on in the user interfaces of most web browsers, such as Internet Explorer, Google Chrome, and Mozilla Firefox. It is the most widely-used client-side scripting language today, due to its ability to make the browser do its work.
In this book, you will gain a deep understanding of JavaScript. You will learn how to write JavaScript in a professional environment using the new JavaScript syntax in ES6, how to leverage JavaScript's asynchronous nature using callbacks and promises, and how to set up test suites and test your code. You will be introduced to JavaScript's functional programming style and you will apply everything you learn to build a simple application in various JavaScript frameworks and libraries for backend and frontend development.
About the Author
Zachary Shute studied computer and systems engineering at RPI. He is now the lead full-stack engineer at a machine learning start-up in San Francisco, CA. For his company, Simple Emotion, he manages and deploys Node.js servers, a MongoDB database, and JavaScript and HTML websites.
Objectives
Examine major features in ES6 and implement those features to build applications
Create promise and callback handlers to work with asynchronous processes
Develop asynchronous flows using Promise chaining and async/await syntax
Manipulate the DOM with JavaScript
Handle JavaScript browser events
Explore Test Driven Development and build code tests with JavaScript code testing frameworks.
List the benefits and drawbacks of functional programming compared to other styles
Construct applications with the Node.js backend framework and the React frontend framework
Audience
This book is designed to target anyone who wants to write JavaScript in a professional environment. We expect the audience to have used JavaScript in some capacity and be familiar with the basic syntax. This book would be good for a tech enthusiast wondering when to use generators or how to use Promises and Callbacks effectively, or a novice developer who wants to deepen their knowledge on JavaScript and understand TDD.
Approach
This book thoroughly explains the technology in an easy-to-understand way, while perfectly balancing theory and exercises. Each chapter is designed to build on what was learned in the previous chapter. The book contains multiple activities that use real-life business scenarios for you to practice and apply your new skills in a highly relevant context.
Minimum Hardware Requirements
For the optimal student experience, we recommend the following hardware configuration:
Processor: Intel Core i5 or equivalent
Memory: 4 GB RAM
Storage: 35 GB available space
An internet connection
Software Requirements
You'll also need the following software installed in advance:
Operating system: Windows 7 SP1 64-bit, Windows 8.1 64-bit, or Windows 10 64-bit
Google Chrome (https://www.google.com/chrome/)
Atom IDE (https://atom.io/)
Node.js and Node Package Manager (npm) (https://nodejs.org/en/)
Access to installation instructions can be provided separately to book material for large training centers and organizations. All source code is publicly available on GitHub and fully referenced within the training material.
Installing the Code Bundle
Copy the code bundle for the class to the C:/Code
folder.
Additional Resources
The code bundle for this book is also hosted on GitHub at https://github.com/TrainingByPackt/Advanced-JavaScript.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Conventions
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The three ways to declare variables in JavaScript: var
, let
, and const
."
A block of code is set as follows:
var example; // Declare variable example = 5; // Assign value console.log( example ); // Expect output: 5
Any command-line input or output is written as follows:
npm install babel --save-dev
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "This means that variables created with block scope are subject to the Temporal Dead Zone (TDZ)."
Installing Atom IDE
To install Atom IDE, go to https://atom.io/ in your browser.
Click on Download Windows Installer for Windows to download the setup file called AtomSetup-x64.exe.
Run the executable file.
Add the
atom
andapm
commands to your path.Create shortcuts on the desktop and Start menu.
Babel is installed locally to each code project. To install Babel in a NodeJs project, complete the following steps:
Open a command, line interface and navigate to a project folder.
Run the command
npm init command
.Fill in all the required questions. If you are unsure about the meaning of any of the prompts, you can press the 'enter' key to skip the question and use the default value.
Run the
npm install --save-dev babel-cli
command.Run the command
install --save-dev babel-preset-es2015
.Verify that the
devDependencies
field inpackage.json
hasbabel-cli
andbabel-presets-es2015
.Create a file called
.babelrc
.Open this file in a text editor and add the code
{ "presets": ["es2015"] }
.
Installing Node.js and npm
To install Node.js, go to https://nodejs.org/en/ in your browser.
Click on Download for Windows (x64), to download the LTS setup file recommended for most users called
node-v10.14.1-x64.msi
.Run the executable file.
Ensure that you select the npm package manager bundle during the setup.
Accept the license and default installation settings.
Restart your computer for the changes to take effect.