I'm trying to get the type of of a string evaluated with eval()
with no success.
The variable is a string stored in an array with the name of a possible object which I want to know if is defined.
Can someone give a hand please?
The troubling line is if ( typeof eval( x[i][0] ) !== 'undefined' )
and this is my code:
var infoslider = [
["revapi5", "el-masnou", "sant-andreu-de-llavaneres"],
["revapi3", "sant-andreu-de-llavaneres", "cardedeu"],
["revapi10", "cardedeu", "eudald-carbonell"],
["revapi9", "arenys-de-mar", "canet-de-mar"]
];
var x = infoslider;
for (var i = 0; i < x.length; i++) {
if ( typeof eval( x[i][0] ) !== 'undefined' ) {
vesa(x[i][0], x[i][2]);
}
}
I get "ReferenceError: revapi5 is not defined"