Simplifying JavaScript
Writing Modern JavaScript with ES5, ES6, and Beyond
Paperback Engels 2018 1e druk 9781680502886Samenvatting
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.
It's time to write JavaScript code that's clean and exprssive. 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 while 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).
Specificaties
Lezersrecensies
Inhoudsopgave
How To Use This Book
Whom This Book Is For
Online Resources
Acknowledgments
1. 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 Strings with Template Literals Convert Variables to Readable Strings with Template Literals
2. 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
3. Maximize Code Clarity with Special Collections 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
Tip 13. Update Key-Value Data Clearly with Maps
Tip 14. Iterate Over Key-Value Data with Map and the Spread Operator 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
4. 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
5. 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
6. Clean Up Parameters and Return StatementsClean 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 Pass a Variable Number of Arguments with the Rest Operator
7. Build Flexible Functions
Tip 32. Write Functions for Testability
Tip 33. Reduce Complexity with Arrow Functions
Tip 34. Maintain Single Responsibility Parameters with Partially Applied Functions
Tip 35. Combine Currying and Array Methods for Partial Application Combine Currying and Array Methods for Partial Application
Tip 36. Prevent Context Confusion with Arrow Functions
8. 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
Tip 42. Resolve Context Problems with Bind()
9. 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 LocalStorage
10. Gather Related Files with Component ArchitectureGather 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
Rubrieken
- advisering
- algemeen management
- coaching en trainen
- communicatie en media
- economie
- financieel management
- inkoop en logistiek
- internet en social media
- it-management / ict
- juridisch
- leiderschap
- marketing
- mens en maatschappij
- non-profit
- ondernemen
- organisatiekunde
- personal finance
- personeelsmanagement
- persoonlijke effectiviteit
- projectmanagement
- psychologie
- reclame en verkoop
- strategisch management
- verandermanagement
- werk en loopbaan