Nader Khan Nader Khan - 4 months ago 11
Javascript Question

jQuery - missing ; before statement

var splitIndexArray = (unformattedArray[0]).split('=')

//alert(splitIndexArray[0]) //alerts correct value
//alert(splitIndexArray[1]) //alerts correct value

var serialNoArray[splitIndexArray[0]]=splitIndexArray[1] //(--> this statement)


gives me an error saying "missing ; before statement"

Answer

This isn't valid:

var serialNoArray[splitIndexArray[0]]

you want to say this:

var serialNoArray = [ ];
serialNoArray[splitIndexArray[0]] = splitIndexArray[1];
Comments