Remove All Ads from XDA

Global variable make app or game slow ?

1 posts
Thanks Meter: 0
By indietab, Junior Member on 26th July 2014, 07:55 AM
Post Reply Subscribe to Thread Email Thread
26th April 2015, 03:34 PM |#11  
Thanks Meter: 30
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

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes