I have an autocomplete text box that users can type an item code into and need to find out what the id number of that item code is in javascript.
An associative arra
Try using Object Literal notation to specify your lookup like this:
var itemIds = { "item1" : 15, "item2" : 40 ... };
Access should still work like this:
var item1Value = itemIds["item1"];