FORUMS

Sunday Debate: Are Smaller Bezels Better or Worth It?

Bezels have been getting smaller and smaller as the years go by, and while devices … more

LG G4 First Impressions and Unboxing – XDA TV

The latest in LG’s signature line of “G phones” has been released. … more

Galaxy S6 Weekly Shooting Challenge

Over in our forums this weekend, XDA Forum member DevonSloan has started a thread for talented … more

Which Features from Apple Watch Do You Think Android Wear Will Copy?

The Apple Watch and Android Wear are both growing platforms. Now … more
Post Reply Subscribe to Thread Email Thread

Global variable make app or game slow ?

26th April 2015, 03:34 PM |#11  
Member
Thanks Meter: 19
 
More
No but if you're using a lot of globals it tends to mean that you're not thinking in an optimal manner for JavaScript coding. Same when people rely on eval(). You need to think less about globals and more about objects, properties, and scopes. JavaScript is fundamentally object oriented, everything is an object... and most objects can contain every other kind of object... do instead of a global called myDataUrl, you could append a .data_url property to the object you created with that data. This way, each such object has that property, you don't have a tonne of globals to manage, and you can access the urls systematically. Generally speaking, a high number of globals signals that you don't understand JavaScript fundamentals and so you're likely doing things in a suboptimal way. THAT could result in slower code that's also hard to maintain code.

Sent from my SM-N910W8 using XDA Free mobile app
 
 
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes