DEV Community

Discussion on: Why should one use multiple Variables when you could store everything in an array?

Collapse
 
tobiassn profile image
Tobias SN

Because with variables you can have actual names, but with an array you only have numbers, and if you remove one element, it pushes everything else to the left, which makes keeping track of stuff difficult. If you just ignore elements you’re not using, you’ll end up wasting a lot of memory. Really, you’re just making yourself deal with a lot of problems that variables don’t have.

Collapse
 
morrisjohn profile image
Morris John

Thank you very much.