Domanda

I wish to store if a specific date is loaded via Javascript. How this boolean is saved/accessed has no difference, however I'm not sure as to what the best solution is performance-wise.

I could know I could store it like this and loop through each object, however I guess this wouldn't really be efficient. var loaded = { {d:23, m:11, y:2012}, {d:24, m:11, y:2012} };

Another idea I have is to store this in an array, like so: loaded[2012][11][23] = true;

But I'm sure there are better ways to accomplish this, so I'd appreciate any guidance

È stato utile?

Soluzione

Unless you have to list available years, available months or available days, you could always use an Object as a dictionary for storing dates as UNIX timestamp numbers (which you can convert to and from Date objects) or "YYYYMMDD" strings.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top