small medium large xlarge

Simplifying JavaScript: Writing Modern JavaScript with ES5, ES6, and Beyond

by

Cover image for Simplifying JavaScript

Simplifying JavaScript

Writing Modern JavaScript with ES5, ES6, and Beyond

by

The best modern JavaScript is simple, readable, and predictable. Learn to write modern JavaScript not by memorizing a list of new syntax, but with practical examples of how syntax changes can make code more expressive. Starting from variable declarations that communicate intention clearly, see how modern principles can improve all parts of code. Incorporate ideas with curried functions, array methods, classes, and more to create code that does more with less while yielding fewer bugs.

Choose Your Format(s)

  • $25.95 In Stock
    • Beta: What do I get?

  • Ebooks are DRM free.

  • Ebook delivery options.

  • The Paper Book will ship on 2018-05-10 (roughly).

About this Title

Skill-meter-1-5
Pages: 300 (est)
Published: 2018-05-10
Release: B2.0 (2018-02-05)
ISBN: 978-1-68050-288-6

It’s time to write JavaScript code that’s clean and expressive. Modern JavaScript is more simple, predictable, and readable than ever. Discover how to write better code with clear examples using principles that show how updated syntax can make code better with fewer bugs.

Starting from the ground up, learn new syntax (or how to reuse older syntax) to transform code from clunky bug-susceptible scripts to clear and elegant programs that are easy to read and easy to extend.

Create a foundation for readable code with simple variable declarations that reduce side effects and subtle bugs. Select collections with clear goals instead of defaulting to objects or arrays. See how to simplify iterations from complex loops to single line array methods. Master techniques for writing flexible and solid code ranging from high-order functions, to reusable classes, to patterns for architecting large applications creating applications that will last through rounds of refactoring and changing requirements.

The best part is there’s no need to read this book straight through. Jump around and incorporate new functionality at will. Most importantly, understand not just what the new syntax is, but when and how to use it. Start writing better code from the first page.

What You Need

For the best experience, have the latest version of Node installed (at least version 7). You can test most examples in the console of Chrome or other modern web browser.

If you’d like to run the tests, you’ll also need to install the latest version of Node Package Manager (npm).

Contents & Extracts

This book is currently in beta, so the contents and extracts will change as the book is developed.

  • Introduction
    • How To Use This Book
    • Who This Book is For
    • Online Resources
  • Signal Intention With Variable Assignment
    • Tip 1. Signal Unchanging Values with const
    • Tip 2. Reduce Scope Conflicts With let and const
    • Tip 3. Isolate Information With Block Scoped Variables
    • Tip 4. Convert Variables to Readable String with Template Literals
  • Manage Data Collections with Arrays
    • Tip 5. Create Flexible Collections with Arrays
    • Tip 6. Check Existence in an Array with Includes
    • Tip 7. Mold Arrays With the Spread Operator
    • Tip 8. Avoid Push Mutations With the Spread Operator
    • Tip 9. Avoid Sort Confusion With the Spread Operator
  • Maximize Code Clarity With Special Collections
    • Tip 10. Use Objects for Static Key-Value Lookups
    • Tip 11. Create Objects Without Mutations Using Object.assign
    • Tip 12. Update Information With Object Spread excerpt
    • Tip 13. Update Key-Value Data Clearly With Maps
    • Tip 14. Iterate Over Key-Value Data With Map and the Spread Operator
    • Tip 15. Create Maps Without Side Effects
    • Tip 16. Keep Unique Values With Set
  • Write Clear Conditionals
    • Tip 17. Shorten Conditionals With Falsy Values
    • Tip 18. Check Data Quickly With the Ternary Operator
    • Tip 19. Maximize Efficiency with Short Circuiting
  • Simplify Loops
    • Tip 20. Simplify Looping With Arrow Functions
    • Tip 21. Write Shorter Loops With Array Methods
    • Tip 22. Create Arrays of a Similar Size With map()
    • Tip 23. Pull Out Subsets of Data With filter() and find()
    • Tip 24. Apply Consistent Actions With forEach
    • Tip 25. Combine Methods With Chaining
    • Tip 26. Transform Array Data With reduce()
    • Tip 27. Reduce Loop Clutter With for…in and for…each
  • Clean Up Parameters and Return Statements
    • Tip 28. Create Default Parameters
    • Tip 29. Access Object Properties with Destructuring
    • Tip 30. Simplify Key-Value Assignment
    • Tip 31. Pass a Variable Number of Arguments with the Rest Operator
  • Build Flexible Functions
    • Tip 32. Write Functions for Testability
    • Tip 33. Simplify Complex Functions With Arrow Functions excerpt
    • Tip 34. Maintain Single Responsibility Parameters with Partially Applied Functions
    • Tip 35. Combine Currying and Array Methods for Partial Application
    • Tip 36. Prevent Context Confusion with Arrow Functions
  • Keep Interfaces Clear with Classes
    • Tip 37. Build Readable Classes
    • Tip 38. Share Methods with Inheritance
    • Tip 39. Extend Existing Prototypes with Class
    • Tip 40. Simplify Interfaces With get and set
    • Tip 41. Create Iterable Properties With Generators excerpt
    • Tip 42. Resolve Context Problems with Bind
  • Access External Data
    • Tip 43. Retrieve Data Asynchronously with Promises
    • Tip 44. Create Clean Functions with Async/Await
    • Tip 45. Make Simple Ajax Calls with Fetch
    • Tip 46. Maintain State Over Time with Local Storage
  • Gather Related Files with Component Architecture
    • Tip 47. Isolate Functionality with Import and Export
    • Tip 48. Leverage Community Knowledge with npm
    • Tip 49. Build Applications With Component Architecture
    • Tip 50. Use Build Tools to Combine Components
    • Tip 51. Leverage CSS For Animations
  • Bibliography

Author

Joe Morgan is a developer out of Lawrence, KS. Joe was born without any code knowledge at all, and since then, he’s been trying to learn a little more every day. A long-time JavaScript fan, he’s enjoying the JavaScript renaissance that has made it more beautiful than ever. He loves writing and speaking on JavaScript and craftsmanship.