Destramic Posted March 19, 2011 Share Posted March 19, 2011 im trying to create a javascript array but im doing something wrong...if anyone could tell me what im doing wrong please...thank you var fields = new array('game_type' : 'Game Type', 'game_abbreviation' : 'Game Abbreviation'); Link to comment https://forums.phpfreaks.com/topic/231083-array/ Share on other sites More sharing options...
tomfmason Posted March 19, 2011 Share Posted March 19, 2011 you could simply use json instead. for example: var fields = {'game_type':'Game Type','game_abbreviation' : 'Game Abbreviation'}; Link to comment https://forums.phpfreaks.com/topic/231083-array/#findComment-1189504 Share on other sites More sharing options...
Destramic Posted March 19, 2011 Author Share Posted March 19, 2011 Thanks it is actually for a json script...so that should do nicely...i'll give it a wirl when I get home...thanks again Link to comment https://forums.phpfreaks.com/topic/231083-array/#findComment-1189510 Share on other sites More sharing options...
.josh Posted March 19, 2011 Share Posted March 19, 2011 As to what you are doing wrong... a) javascript is case-senstive, it is Array() not array() b) you cannot assign elements to the array by passing them in the Array() object instantiation. The only argument Array() accepts is an optional integer to specify the array length. Link to comment https://forums.phpfreaks.com/topic/231083-array/#findComment-1189529 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.