A Better Way To Learn JavaScript
$19.00
Minimum price
$29.00
Suggested price

A Better Way To Learn JavaScript

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!

Along the way, you'll learn how to build truly useful apps in JavaScript, which will speed up your workflow and help you with your daily tasks.

About the Author

Ajdin Imsirovic
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses (way back in 2015) on the subject of web design and web development. 

Before self-publishing books on Leanpub, he authored four books on front-end development for Packt Publishing:

  1. Vue CLI 3 Quick Start Guide (Build and maintain Vue.js applications quickly with the standard CLI), May 2019
  2. Vue.js Quick Start Guide (Learn how to build amazing and complex reactive web applications easily using Vue.js), October 2018
  3. Elm Web Development (An introductory guide to building functional web apps using Elm), March 2018
  4. Bootstrap 4 Cookbook (Over 75 recipes to help you build elegant and responsive web applications with Bootstrap 4), June 2017

Additionally, he's published a number of books on the Leanpub platform, specifically:

  1. A Better Way to Learn JavaScript - The Basics: https://bit.ly/abwtljs1
  2. A Better Way to Learn JavaScript - Built-in Objects: https://bit.ly/abwtljs2
  3. A Better Way to Learn JavaScript - Useful Snippets: https://bit.ly/abwtljs3
  4. A Better Way to Learn JavaScript - Mini Apps: https://bit.ly/abwtljs4
  5. A Better Way to Learn JavaScript - Advanced JavaScript: https://bit.ly/abwtljs5
  6. Angular From Scratch: https://bit.ly/ai-afs
  7. Vue.js From Scratch: https://bit.ly/ai-vfs
  8. React from Scratch: https://leanpub.com/react-from-scratch
  9. Building Amazing Layouts - Learn the Basics of HTML5, CSS3, and Bootstrap 5: https://bit.ly/bldamzlyts1
  10. Building Amazing Layouts - Bootstrap 5 Layouts in Depth: https://bit.ly/bldamzlyts2

Bundles that include this book

$145.00
Bought separately
$99.95
Bundle Price

Reader Testimonials

Peter Lin
Peter Lin

https://twitter.com/PeterLin88

Hi Ajdin, I have been really enjoying learning from your 5 books of a-better-way-to-learn-javascript. It is really a better learning experience comparing to my reading of other JavaScript books or video causes. I have been very happy that I found and purchased them at leanpub.com. Excellent!! :)

Table of Contents

  • 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
    • 1. “Map of the JavaScript land”
    • 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?
    • 2. Why JavaScript?
    • 3. The JS ecosystem
    • 4. How to get started
    • 5. Playing by JS’ rules meaningfully
    • 6. Can your calculator do that?
    • 7. Recap
    • Conclusion
  • Chapter 2: Evaluation, data types, operators, variables, and conditionals
    • Evaluation in JavaScript
    • Operators in JavaScript
    • Introduction to variables
    • Variables, assignment, and typeof
    • Revisiting data types: strings vs numbers
    • Making JavaScript respond in plain English
    • Build your first simple game in JavaScript
    • A gentle introduction to the object data type in JavaScript
    • 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
  • Chapter 3: Functions, primitives, and objects in JavaScript
    • A Function is A Machine
    • Generalizing Functions in JavaScript
    • Anonymous functions
    • Revisiting the age-checker app
    • Conclusions
    • 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
    • Conclusion
  • Chapter 5: Understanding Events in JavaScript
    • What are Events in JavaScript
    • Inline Event Handlers Using HTML Attributes
    • How JavaScript Deals with Events
    • 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
    • Adding the textToEdit and popUpEditor divs
    • Styling the popUpEditor
  • Chapter 8: The Anatomy of functions in ES6
    • Comparing ES5 and ES6 functions in JavaScript
    • Function definitions with a single parameter
    • Function definitions with no parameters
    • Converting ES5 to ES6 functions (and vice-versa)
  • Chapter 9: Learning JavaScript basics by coding tiny apps
    • What’s fiction writing have to do with coding?
    • Version one of our Learning JavaScript Project
    • Version two of our Learning JavaScript Project
    • 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
    • Add CSS classes using JavaScript
    • Conclusion
  • Chapter 10: Data Types and Constructors
    • Objects VS non-objects
    • Finding the type of primitives using the typeof operator
    • The number type
    • The null type
    • The undefined type
    • The boolean type
    • The bigint type
    • The symbol type
    • Understanding primitive data types in JavaScript
    • Primitive types cannot be mutated
    • The object type
    • Wrapper objects on primitives in JavaScript
    • Type constructors in JavaScript: The good, the bad, and the ugly
    • 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!
    • Comparing primitive values in JavaScript
    • Comparing objects in JavaScript
    • Primitives are passed by value
    • Objects are passed by reference
    • Truthy and falsy values and coercion in JavaScript
    • Conclusion
  • Chapter 11: JavaScript and the Browser
    • “The states of matter” of a web page
    • A sneak preview: document.write
    • What is the DOM?
    • Is the DOM a part of JavaScript?
    • Where does JavaScript live?
    • Browser and Web APIs
    • JavaScript Engines and Browser Engines
    • How a JavaScript Engine Works
    • The Memory Heap
    • The Call Stack
    • Stack Overflow
    • Recursion in JavaScript
    • The memory heap and JavaScript variables
    • 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
    • Conclusion
  • Chapter 12: JavaScript is Synchronous, Browser is Asynchronous
    • JavaScript is Single-Threaded and Synchronous
    • Synchronous JavaScript in an Asynchronous Browser
    • Conclusion
  • Chapter 13: Basic JavaScript Caveats
    • 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
    • Using call() and apply()
    • Implicit and explicit context of this
    • Using bind()
    • Working with local storage
    • Method chaining
    • JavaScript loading in an HTML page
    • Nullish coalescing operator
    • Optional chaining operator
  • Chapter 14: The Anatomy of a JavaScript Function: all the different ways of defining functions in JS
    • 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
    • 2f. How does the JavaScript engine load functions into the execution context?
    • 3. Function constructors
    • 4. Generator functions
    • 5. Async / await functions
    • Conclusion
  • Chapter 15: Understanding arguments and the spread operator
    • How many arguments does a function expect?
    • The arguments variable
    • Can we use the arguments variable with arrow functions?
    • How does the spread operator work in arrow functions?
    • Understanding the arguments local variable in depth
  • Chapter 16: JavaScript Arrays in Depth
    • Using the delete method on an array member
    • Does a value exist in an array?
    • Use Array.length to find the last member of array
    • Use Array.length to quickly trim an array
    • Manipulating arrays with pop
    • Manipulating arrays with push
    • Manipulating arrays with shift
    • Manipulating arrays with unshift
    • Manipulating arrays with Array.slice and Array.splice
    • Destructuring Arrays
    • Concat two arrays together
    • Convert an array to a string
    • Flipping the order of items in an array
    • Sorting arrays with Array.sort
    • Exercise: Sort a todo list
    • Additional Exercise: Reverse the order of array
    • Looping over arrays
    • 2. Using the “optimized” for loop
    • 3. Looping over a JS array with for-of
    • 4. Don’t loop over a JS array with for-in
    • 5. Looping over a JS array with the while loop
    • 6. Looping over a JS array with the do while loop
    • Functional approach to looping over arrays in JS
    • 7. Looping over arrays in JS with forEach
    • 8. Looping over arrays in JS with Array.prototype.filter
    • Using Array.prototype.filter followed by Array.prototype.forEach
    • 10. Using Array.prototype.map
    • 11. Using Array.prototype.reduce
    • 12. Using Array.prototype.some
    • 13. Array.prototype.every
    • 14. Using Array.prototype.find
    • 15. Using Array.prototype.sort
    • Looping over arrays: Conclusion
  • Chapter 17: Sets and Maps in JavaScript
    • 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
    • Practical Uses of Weak Sets in JavaScript
    • Looping over sets and weak sets
    • Working with maps in JavaScript
    • 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
  • Chapter 18: JavaScript Objects in Depth
    • What are objects in JS?
    • Object literals and object accessors
    • Nesting objects in other objects in JavaScript
    • Working with object properties
    • Running CRUD operations on object properties in JavaScript using brackets notation
    • 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
    • JavaScript objects are “pass-by-reference”
    • Passing objects to functions
    • Accessing object properties from object methods
    • Using Object.create method
    • Built-in objects in JavaScript
    • The String object
    • The RegExp object
    • Using RegExp in JavaScript
    • Date object
    • JSON (JavaScript Object Notation)
    • 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
    • Destructuring objects in JavaScript
  • Chapter 19: Working with Objects, Arrays, and JSON
    • Working With JSON Received From The Web
  • Chapter 20: Functional programming in JavaScript
    • What is it?
    • FP vs OOP
    • Declarative and Imperative Paradigms
    • Side Effects and Pure Functions
  • Chapter 21: Object-Oriented Programming in JavaScript
    • What is OOP?
    • Polymorphism
    • Encapsulation
    • Inheritance
    • Classes
    • Objects Store Both Functions And Data
    • Building multiple objects
    • Linking Objects with Object.create
    • My name is Proto, Dunder Proto
    • In JavaScript, functions are objects
    • The Proper Way to Use prototype Is With A Constructor Function
    • Getting an Object’s Prototype
    • Why JavaScript is not class-based “under the hood”
    • Constructor functions and object-oriented JavaScript
    • Arrow functions fix the this reference in inner functions
    • Extending Array.prototype with defineProperty
    • Using classes in JavaScript
    • Why use classes over prototypes?
    • Object is a global constructor function
    • Three ways to check for prototype
    • Practice makes perfect: the prototype chain
    • The instanceof operator and object-oriented JavaScript
    • Function, Object and instanceof
    • The Constructor Property
    • Chaining constructors for an object with call
    • Practice makes perfect: let’s build a prototype chain!
    • Using Object.create to add prototypes for objects
    • Static Methods
    • Public and Private Methods
    • Inheritance using extends and super
    • Monkey-patching
    • By-passing inheritance using mixins
    • Shallow copy and deep copy
    • Addendum: A non-trivial OOP example using classes in JavaScript
    • Another example
  • Chapter 22: Errors, debugging, and strict mode
    • Throwing errors in JavaScript
    • The try...catch...finally statement
    • Throwing the error
    • Catching the error
    • As soon as an error is thrown, the try block is DONE
    • The finally statement
    • Catching all types of errors
    • Custom error messages
    • Stack Trace
    • Using console.trace()
    • Traces and function names
    • Debugging with console.trace()
    • 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
    • 5. The with statement is forbidden
    • 6. Decimals with leading zeros are not allowed
    • 7. Not allowed to set or delete immutable properties
    • BROWSER SNIFFING
    • FEATURE SNIFFING
    • DEBUGGING JAVASCRIPT
    • 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
    • Using the debugger keyword 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
    • JavaScript sourcemaps
    • AVOIDING THE NEED TO DEBUG
    • LINTERS AND CODE EDITORS
    • Installing ESLint with npm
  • Chapter 23: Modular JavaScript
    • What problems does modular JavaScript code solve
    • 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
    • Modular JavaScript
    • We can’t use require in 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?
    • Adding webpack to our JavaScript programs
    • Understanding the structure of the node_modules folder
    • Working with npm scripts
    • Running files with Node.js using npm scripts
    • Running webpack on our project’s files
    • Running webpack on vanilla JavaScript modules
    • Compiling JavaScript modules to a custom output with webpack
    • Specifying custom entry file in the webpack configuration
    • Building HTML files with webpack
    • The module object
    • Exporting various values with module.exports
    • How to set up webpack with html files
    • Conclusion
  • Chapter 24: JavaScript Object Notation (JSON)
    • 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 undefined vs running it on null
    • Conclusion
  • Chapter 25: Asynchronous JavaScript
    • 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
    • Promises
    • Working with promises using the fetch() method
    • Understanding promises
    • What is the contents of [[]]?
    • Dealing with rejected promises using the catch() method
    • Error handling in promises with catch() and finally()
    • Dealing with rejected promises by passing the second argument to the then() method
    • 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
    • Generators
    • An instance of GeneratorFunction is an iterable object!
    • Returning values dynamically with yield
    • Combining generators with promises
    • Async/Await
    • Observables
    • Revisiting the iterator patern
    • The observer pattern
    • Observables in vanilla JS
    • Revising observables
    • Subscribing to an observable data stream with RxJS
  • Chapter 26: Conclusion: The JavaScript Learning Fractal

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.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

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 $13 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.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub