I have some arrays defined in js, and I want to use the variable's value to select which array should I select.
// My arrays
var battery = [123, 321, "", ""];
var cables = [234, 432, "", ""];
$(document).ready(function() {
var file = "battery.jpg";
var item = file.slice(0, -4); // item = "battery"
console.log($(item)[0]); // undefined and I was hoping to log "123" - battery[0]
});