Save Yourself From 1000 Hours of Trial and Error Experiences!
About the Book
This book is based on a tried and tested learning methodology.
This learning methodology will give you the best possible results in the shortest amount of time!
Chapter 0: Why this book?
- The history of this book (and the book series)
- You can’t make everyone happy
- This one goes out to the happy ones
- How is this book organized?
- The methodology: Bloom’s taxonomy
- 2. Types of tutorials
- 3. Focusing on “knowledge transfer”, not “feature-listing”
- 4. Most of these books are either too theoretical or too practical
- What We’re Building
- Accompanying website
- List of major updates
Chapter 1: Starting slowly
- 1. Why programming?
- 3. The JS ecosystem
- 4. How to get started
- 5. Playing by JS’ rules meaningfully
- 6. Can your calculator do that?
- 7. Recap
Chapter 2: Evaluation, data types, operators, variables, and conditionals
- Introduction to variables
- Variables, assignment, and typeof
- Revisiting data types: strings vs numbers
- Understanding key-value pairs
- Re-writing your first simple game using objects (and comments!)
- If statements and blocks of code
- Conditionally executing multiple lines of code
- The basics of data type conversion
- A Function is A Machine
- Anonymous functions
- Revisiting the age-checker app
- What’s next?
- A quick note about var, let and const
Chapter 4: The Quick Prototype App
- Concepts to understand before building the app
- Building the Quick Prototyper App
- Using Github to Share code
- Updating Our Web Page Dynamically
- Reinforcing Your Learning Using Devtools Snippets
- Start Building the Quick Prototyper snippet
- Checking for Equality and Running Code Conditionally
- Adding a Second Component to Quick Prototyper
- Passing Custom Arguments to Function Calls Based on User Input
- Using else if
- Working with the button classes in Quick Prototyper
- Prompting For Multiple Components At a Time
- Inline Event Handlers Using HTML Attributes
- Stopping Event Propagation
- Add an Event Handler to the Page Dynamically
- The Event Object
- Review: How does browser handle events?
- Some more practice
Chapter 6: Improving the UX on Quick Prototyper
- Adding badges to the list of components
- Adding Buttons To our App
- Adding the Navbar to our QuickPrototyper
- List of Updates Made to QuickPrototyperV10
Chapter 7: Introducing jQuery
- Understanding the basics of jQuery
Chapter 8: The Anatomy of functions in ES6
- Function definitions with a single parameter
- Function definitions with no parameters
- Converting ES5 to ES6 functions (and vice-versa)
- What’s fiction writing have to do with coding?
- Why is this important?
- Learning JS basics by coding tiny apps: Let’s build a choices game
- Escaping the console and the prompt function
- Building the “JS Money” game
- Using a ternary expression in our game
Chapter 10: Data Types and Constructors
- Objects VS non-objects
Finding the type of primitives using the
- The number type
- The null type
- The undefined type
- The boolean type
- The symbol type
- Primitive types cannot be mutated
- The object type
- What does the “new” operator do?
- Some built-in objects don’t need a constructor - because they’re static objects
- Building objects with user-defined constructor functions
- Rule of thumb: use literals rather than object function constructors
- Typecasting with type constructors
- Forgetting the new keyword pollutes global scope!
- Primitives are passed by value
- Objects are passed by reference
- “The states of matter” of a web page
A sneak preview:
- What is the DOM?
- Browser and Web APIs
- The Memory Heap
- The Call Stack
- Stack Overflow
- Variable hoisting VS function hoisting
- Using the debugger to understand hoisting
- The global object
- The call stack, the global object, and the keyword “this”
- Functions, call stack, and execution contexts
- Why do we need the scope chain?
- Sibling functions don’t share a scope chain
- Back to the this keyword
- Higher-order functions
- Revisiting scope: global, function, and block scope
- Closures (the products of higher-order functions)
- Lexical Scope
- Variables: var VS let and const
- Operator precedence and associativity
- Default parameters in functions
Implicit and explicit context of
- Working with local storage
- Method chaining
- Nullish coalescing operator
- Optional chaining operator
- 1. Function declarations
- 1a. Conditionals and function declarations
- 2. Function expressions
- 2a. Function expressions as IIFEs
- 2b. Function expressions as object methods
- 2c. Function expressions as shorthand methods in ES6 object literals
- 2d. Function expressions as shorthand methods with the computed properties syntax
- 2e. Function expressions as callbacks
- 2f. Function expressions as arrow functions
- 3. Function constructors
- 4. Generator functions
- 5. Async / await functions
Chapter 15: Understanding arguments and the spread operator
- How many arguments does a function expect?
- Can we use the arguments variable with arrow functions?
- How does the spread operator work in arrow functions?
argumentslocal variable in depth
deletemethod on an array member
- Does a value exist in an array?
Array.lengthto find the last member of array
- Use Array.length to quickly trim an array
Manipulating arrays with
Manipulating arrays with
Manipulating arrays with
Manipulating arrays with
Manipulating arrays with
- Destructuring Arrays
- Concat two arrays together
- Convert an array to a string
- Flipping the order of items in an array
Sorting arrays with
- Exercise: Sort a todo list
- Additional Exercise: Reverse the order of array
- Looping over arrays
2. Using the “optimized”
3. Looping over a JS array with
4. Don’t loop over a JS array with
- 5. Looping over a JS array with the while loop
6. Looping over a JS array with the
- Functional approach to looping over arrays in JS
7. Looping over arrays in JS with
8. Looping over arrays in JS with
- Looping over arrays: Conclusion
- Using the
- A Set is a Collection of Unique Members
- Convert a set to an array
- Convert an array to a set
- Remove duplicates from an array using a set
- Just for fun (re-duplicate an array)
- Does a value exist in a set?
- Sets don’t consider objects the same even if they hold the same values
- Check the length of a set
- Using two sets to find the items that exist in both
- Deleting set members
- Comparing sets and weak sets
- Looping over sets and weak sets
- A map is like a “countable” object (i.e. a dictionary)
- Using the map data structure in JS
- Populating a map data structure in JS
- Retrieving all the key-value pairs from a map
- Passing more than one key-value pairs to a new map
- What is the size of a specific map?
- Adding key-value pairs to existing maps
- Does a key exist in a map?
- Returning a value from a map key in JS
- Deleting key-value pairs from maps in JS
- Clearing a map of all key-value pairs
- Convert a map to an array
- Convert a map to an object
- Comparing maps and objects
- Weak maps in JS
- Weak maps and weak sets help with memory use
- Looping over maps
- Looping over a map with a forEach
- What are objects in JS?
- Object literals and object accessors
- Working with object properties
- The difference between the dot notation and the brackets notation for object access
- Using ternary expressions to determine the value of a property
- Evaluating expressions inside objects using the brackets notation
- Listing out object properties
- Passing objects to functions
- Accessing object properties from object methods
- The String object
- The RegExp object
- Date object
- Math object
- Working with property descriptors
- Working with the writable property descriptor
- Working with the enumerable property descriptor
- Working with the configurable property descriptor
- Working with getters and setters
Chapter 19: Working with Objects, Arrays, and JSON
- Working With JSON Received From The Web
- What is it?
- FP VS OOP
- Declerative and imperative paradigms
- Side effects and pure functions
- Function Composition, Partial Application, and Currying
- What is OOP?
- Objects Store Both Functions And Data
- Building multiple objects
- Linking Objects with Object.create
- My name is Proto, Dunder Proto
The Proper Way to Use
prototypeIs With A Constructor Function
- Getting an Object’s Prototype
Arrow functions fix the
thisreference in inner functions
Extending Array.prototype with
- Why use classes over prototypes?
Objectis a global constructor function
- Three ways to check for prototype
- Practice makes perfect: the prototype chain
- The Constructor Property
Chaining constructors for an object with
- Practice makes perfect: let’s build a prototype chain!
Object.createto add prototypes for objects
- Static Methods
- Public and Private Methods
- By-passing inheritance using mixins
- Shallow copy and deep copy
- Another example
Chapter 22: Errors, debugging, and strict mode
- Throwing the error
- Catching the error
- As soon as an error is thrown, the try block is DONE
- Catching all types of errors
- Custom error messages
- Stack Trace
- Traces and function names
- Stack tracing Error constructors
- Strict mode
- 1. All variables must be declared
- 2. Non-writable global variables cannot be used as a variable names
- 3. Duplicate parameters are not allowed
- 4. Functions must be declared in the global scope or directly inside a function
withstatement is forbidden
- 6. Decimals with leading zeros are not allowed
- 7. Not allowed to set or delete immutable properties
- BROWSER SNIFFING
- FEATURE SNIFFING
- Debugging with console and alert
- The quickest way to run the built-in devtools debugger
- Pausing on exceptions
- What is a breakpoint?
- Local scope, global scope, and closures in the debugger
debuggerkeyword to programmatically set a breakpoint
- Editing breakpoints (watching expressions)
- Working with different types of breakpoints
- Step over, step into, step out, and step
- Debugging with the Step into next function call button
- The Deactivate / Activate breakpoints button
- Inspecting the call stack
- Debugging with Chrome devtools Performance panel
- Blackboxing scripts
- AVOIDING THE NEED TO DEBUG
- LINTERS AND CODE EDITORS
- Installing ESLint with npm
- How to install Node and npm on our machine?
- Adding a new project with npm
- Adding actual code to our npm project
- Collaborating in a team using npm
- Using npm scripts and task runners
We can’t use
requirein the browser
- What is a module bundler?
- Working with ES6 modules (ESM syntax)
- Working with ES6 modules in the browser
- Running an Express server
- How does webpack work?
Understanding the structure of the
- Working with npm scripts
- Running files with Node.js using npm scripts
- Running webpack on our project’s files
- Specifying custom entry file in the webpack configuration
- Building HTML files with webpack
Exporting various values with
- How to set up webpack with html files
- What is JSON
- Why is JSON so popular?
- What does valid JSON look like
- Using JSON tools for increased productivity
- Looping over JSON objects
- Making AJAX requests to get JSON data from the web
- An alternative solution to printing JSON data to screen
- Transforming objects to arrays to deal with JSON data, explanation
- Making AJAX requests to get JSON data from our own computer
- Printing data to screen using nested for loops
Running JSON.parse on
undefinedvs running it on
- What are blocking operations?
- The XMLHttpRequest constructor
- The anatomy of an XHR request
- What are callbacks?
- Let’s build callbacks from ground up
- Functions are first-class citizens
- Passing strings to functions
- Passing function invocations to functions
- Higher-order functions take or return other functions
- Passing named function declarations to other functions
- Passing anonymous functions to higher order functions
- Understanding callbacks in general
- Callbacks are everywhere
- Running a callback function when a button is clicked
- Using callbacks to run XHR requests
- Asynchronous XHR inside a callback function
- The biggest difference between regular functions and asynchronous (callback) functions
- The problem with callbacks
- Callbacks and the inversion of control
- Callback hell aka The Pyramid of Doom
- A more realistic example of callback hell
- Intermission: where we’re at
- Dealing with errors in callbacks
- Dealing with errors in callbacks without using a third-party library like jQuery
- Dealing with callback hell
Working with promises using the
- Understanding promises
What is the contents of
Dealing with rejected promises using the
Error handling in promises with
Dealing with rejected promises by passing the second argument to the
- How do the functions deferred by a promise get back onto the call stack?
- A few important conclusions regarding promises
- Working with Promise.all
- Iterators and Generators
- Iterators perform work on streams of data
- The iteration protocol
- An instance of GeneratorFunction is an iterable object!
Returning values dynamically with
- Combining generators with promises
- Revisiting the iterator patern
- The observer pattern
- Observables in vanilla JS
- Revising observables
- Subscribing to an observable data stream with RxJS
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.