I am working with an array of filenames called ret
, and I need to extract the extension of each file name.
var cList="";
var fName="";
var ext="";
for(var i=0;i<=ret.length-1;i++){
fName=ret[i];
ext=fName.split('.').pop();
if(ext=="msi"){
cList+="<br><span class='bld'>Yield Monitor Simulators</span><p>";
}
cList+="<a target='_blank' href='"+httpBase+"cheatsheets/"+fName+"'>"+fName+"</a><br>";
}
However, when I try to split the filename using:
ext=fName.split('.').pop();
I encounter the error message:
"Uncaught TypeError: undefined is not a function"
If I comment out that line, the list of files is displayed as expected.
var cList="";
var fName="";
var ext="";
for(var i=0;i<=ret.length-1;i++){
fName=ret[i];
//ext=fName.split('.').pop();
if(ext=="msi"){
cList+="<br><span class='bld'>Yield Monitor Simulators</span><p>";
}
cList+="<a target='_blank' href='"+httpBase+"cheatsheets/"+fName+"'>"+fName+"</a><br>";
}
The JSFiddle example works fine, so the issue seems to be within my code...