Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
56
rated 0 times [  63] [ 7]  / answers: 1 / hits: 87609  / 14 Years ago, thu, july 15, 2010, 12:00:00

How can i make it nicer?



var month = new Array();

month['01']='Jan';
month['02']='Feb';
month['03']='Mar';


etc. Itd be nice to do it like:



var months = new Array(['01','Jan'],['02','Feb'],['03','Mar']);


For example. anyway like that to simplify it?


More From » arrays

 Answers
2

this should do it ..



var months = {'01':'Jan', '02':'Feb'};
alert( months['01'] );

[#96216] Tuesday, July 13, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kylanalis

Total Points: 438
Total Questions: 85
Total Answers: 102

Location: Barbados
Member since Sun, Nov 27, 2022
1 Year ago
kylanalis questions
Sat, Oct 2, 21, 00:00, 3 Years ago
Tue, Oct 13, 20, 00:00, 4 Years ago
Thu, Feb 13, 20, 00:00, 4 Years ago
Tue, Jan 7, 20, 00:00, 4 Years ago
;