could someone maybe tell me why I'm getting the error Unable to get property 'substr' of undefined or null reference
? I only get this error on IE browsers (including Edge) - all other browsers work fine:
share.getMedia = function (arrClassList) {
var mediaType;
if (arrClassList.length > 1) {
for (var i = 0; arrClassList.length >= i; i++) {
if (typeof arrClassList[i] != "undefined") {
var currentString = arrClassList[i].substr(2);
if (currentString.indexOf(arrTemplates)) {
mediaType = currentString;
}
}
}
} else {
if (typeof arrClassList[0] != "undefined") {
var currentString = arrClassList[0].substr(0, 2);
if (currentString.indexOf(arrTemplates)) {
mediaType = currentString;
}
}
}
return mediaType;
};
UPDATE: when I do console log the arrClassList
I indeed get an object:
{
0: "social",
1: "facebook"
}
Does somebody know what the issue is here? It only happens in IE + Edge browser...