JavaScript Unlocked
eBook - ePub

JavaScript Unlocked

Dmitry Sheiko

Share book
  1. 182 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

JavaScript Unlocked

Dmitry Sheiko

Book details
Book preview
Table of contents
Citations

About This Book

Improve your code maintainability, performance, and security through practical expert insights and unlock the full potential of JavaScript

About This Book

  • Improve your JavaScript code for better maintainability and performance
  • Discover how to implement scalable application architecture with JavaScript
  • Learn to use JavaScript behind the browser, including its command-line tools, desktop apps, and native mobile apps

Who This Book Is For

JavaScript Unlocked is for those JS developers who want to see just how far they can push their favourite language through practical insight and techniques.

What You Will Learn

  • Make your code readable and expressive by using simple syntax of JavaScript
  • Grasp existing JavaScript collections such as arrays and array-like objects
  • Develop abstract data types in most effective way to extend JavaScript into a more flexible and powerful programming language
  • Examine the pros and cons of JavaScript by implementing real-time code examples
  • Flourish real-time mini-projects by using JavaScript on server side to develop desktop as well as mobile applications
  • Work on parallel tasks with asynchronous JavaScript
  • Improve code maintainability and readability and boost apps performance through JavaScript

In Detail

JavaScript stands bestride the world like a colossus. Having conquered web development, it now advances into new areas such as server scripting, desktop and mobile development, game scripting, and more. One of the most essential languages for any modern developer, the fully-engaged JavaScript programmer need to know the tricks, non-documented features, quirks, and best practices of this powerful, adaptive language.

This all-practical guide is stuffed with code recipes and keys to help you unlock the full potential of JavaScript. Start by diving right into the core of JavaScript, with power user techniques for getting better maintainability and performance from the basic building blocks of your code. Get to grips with modular programming to bring real power to the browser, master client-side JavaScript scripting without jQuery or other frameworks, and discover the full potential of asynchronous coding. Do great things with HTML5 APIs, including building your first web component, tackle the essential requirements of writing large-scale applications, and optimize JavaScript's performance behind the browser. Wrap up with in-depth advice and best practice for debugging and keeping your JavaScript maintainable for scaling, long-term projects. With every task demonstrated in both classic ES5 JavaScript and next generation ES6-7 versions of the language, Whether read cover-to-cover or dipped into for specific keys and recipes, JavaScript Unlocked is your essential guide for pushing JavaScript to its limits.

Style and approach

This practice-oriented cookbook is packed full of code examples put in the form: problem, classical solution, and methods to optimize webpage in both JavaScript ES5 and ES6 language editions. But this thorough guide is best-suited to those who like to "learn by doing" as the topics are covered using real-life examples and tutorials.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is JavaScript Unlocked an online PDF/ePUB?
Yes, you can access JavaScript Unlocked by Dmitry Sheiko in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Programación en JavaScript. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785881572

JavaScript Unlocked


Table of Contents

JavaScript Unlocked
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Diving into the JavaScript Core
Make your code readable and expressive
Function argument default value
Conditional invocation
Arrow functions
Method definitions
The rest operator
The spread operator
Mastering multiline strings in JavaScript
Concatenation versus array join
Template literal
Multi-line strings via transpilers
Manipulating arrays in the ES5 way
Array methods in ES5
Array methods in ES6
Traversing an object in an elegant, reliable, safe, and fast way
Iterating the key-value object safely and fast
Enumerating an array-like object
The collections of ES6
The most effective way of declaring objects
Classical approach
Approach with the private state
Inheritance with the prototype chain
Inheriting from prototype with Object.create
Inheriting from prototype with Object.assign
Approach with ExtendClass
Classes in ES6
How to – magic methods in JavaScript
Accessors in ES6 classes
Controlling access to arbitrary properties
Summary
2. Modular Programming with JavaScript
How to get out of a mess using modular JavaScript
Modules
Cleaner global scope
Packaging code into files
Reuse
Module patterns
Augmentation
Module standards
How to use asynchronous modules in the browser
Pros and cons
How to – use synchronous modules on the server
Pros and cons
UMD
JavaScript's built-in module system
Named exports
Default export
The module loader API
Conclusion
Transpiling CommonJS for in-browser use
Bundling ES6 modules for synchronous loading
Summary
3. DOM Scripting and AJAX
High-speed DOM operations
Traversing the DOM
Changing the DOM
Styling the DOM
Making use of attributes and properties
Handling DOM events
Communicating with the server
XHR
Fetch API
Summary
4. HTML5 APIs
Storing data in web-browser
Web Storage API
IndexedDB
FileSystem API
Boosting performance with JavaScript workers
Creating the first web component
Learning to use server-to-browser communication channels
Server-Sent Events
Web Sockets
Summary
5. Asynchronous JavaScript
Nonblocking JavaScript
Error-first Callback
Continuation-passing style
Handling asynchronous functions in the ES7 way
Parallel tasks and task series with the Async.js library
Event handling optimization
Debouncing
Throttling
Writing callbacks that don't impact latency-critical events
Summary
6. A Large-Scale JavaScript Application Architecture
Design patterns in JavaScript
Understanding concern separation in JavaScript
MVVM
Using JavaScript MV* frameworks
Backbone
Angular
React
Summary
7. JavaScript Beyond the Browser
Levelling up the coding of a command-line program in JavaScript
Building a web server with JavaScript
Writing a desktop HTML5 application
Setting up the project
Adding the HTML5 application
Debugging
Packaging
Using PhoneGap to make a mobile native app
Setting up the project
Building the project
Adding plugins
Debugging
Summary
8. Debugging and Profiling
Hunting bugs
Getting the best from a console API
Tuning performance
Summary
Index

JavaScript Unlocked

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2015
Production reference: 1011215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-157-2
www.packtpub.com

Credits

Author
Dmitry Sheiko
Reviewer
Durgesh Priyaranjan
Commissioning Editor
Wilson Dsouza
Acquisition Editor
Meeta Rajani
Content Development Editor
Priyanka Mehta
Technical Editor
Mohita Vyas
Copy Editor
Kausambhi Majumdar
Project Coordinator
Izzat Contractor
Proofreader
Safis Editing
Indexer
Tejal Soni
Graphics
Abhinash Sahu
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat

About the Author

Dmitry Sheiko is a passionate blogger and the author of Instant Testing with QUnit.
Dmitry got hooked to computer programming in the late '80s. For the last 18 years, he has been in web development. His very first open source contribution was an XSLT-based CMS in 2004. Since then, he has been contributing quite a lot to FOSS. You can find Dmitry's latest works at https://github.com/dsheiko. Currently, he is working as a web developer in the lovely city of Frankfurt am Main at Crytek GmbH.

About the Reviewer

Durgesh Priyaranjan is a senior software developer who has been working on various technologies. However, he loves JavaScript programming and interaction design the most. He is currently based in Bengaluru (India) and is working as a UI engineer for one of the Indian e-commerce giants, Flipkart.
He loves trying out different technologies without any bias. Of late, he can be found tinkering around with Raspberry Pi.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.
At www.PacktPub.com, you can also read a collection of free t...

Table of contents