I have this object/array thing:
var states = {};
states["CA"] = new State("CA", "California");
states["AR"] = new State("AR", "Arizona");
....
How can I check if states["AL"] has been set or not? Will the following work (in all browsers)?
if (states["AL"] == undefined)
alert("Invalid state");
Recommended:
Litteral
undefinedis possible and will work most of the time, but won’t in some browser (IE mac, maybe others).