Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering The Faster Web with PHP, MySQL, and JavaScript

You're reading from   Mastering The Faster Web with PHP, MySQL, and JavaScript Develop state-of-the-art web applications using the latest web technologies

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781788392211
Length 278 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Andrew Caya Andrew Caya
Author Profile Icon Andrew Caya
Andrew Caya
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Faster Web – Getting Started FREE CHAPTER 2. Continuous Profiling and Monitoring 3. Harnessing the Power of PHP 7 Data Structures and Functions 4. Envisioning the Future with Asynchronous PHP 5. Measuring and Optimizing Database Performance 6. Querying a Modern SQL Database Efficiently 7. JavaScript and Danger-Driven Development 8. Functional JavaScript 9. Boosting a Web Server's Performance 10. Going Beyond Performance 11. Other Books You May Enjoy

The global object and local variables


JavaScript’s global object is the container of all global variables. Any top-level variable of any compilation unit will be stored in the global object. The global object is one of the worst parts of JavaScript when it is not used correctly, as it can easily become bloated with unneeded variables and can be unknowingly abused by developers when JavaScript default behavior is heavily relied upon. Here are two examples of such misuse:

  • When running a simple code such as total = add(3, 4);, you are, in fact, creating a property named total in the global object. This is not a good thing for performance as you might keep a lot of variables on the heap while most of them are only required at a certain moment of an application's execution.
  • When neglecting to use the new keyword in order to create an object, JavaScript will execute an ordinary function call and will bind the this variable to the global object. This is a very bad thing, not only for security reasons...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime