FORUMS

Google Photos ‘Unlimited’ Storage Reportedly Being Capped

When Google Photos was announced, many of us thought very highly … more

Sprint Moves to Lift Video Streaming Limit for All-In

Yesterday, Sprint announced a new unlimited scheme that offered customers an … more

Xiaomi Releases Kernel Source Code For Mi4i

If you’ve been following the XDA News Portal lately, you might have noticed an … more

How to Listen to Beats 1 on Android Right Now

If you felt a bit left out by Apple launching their own online radio station Beats 1 … more

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  
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