Currently, I am working on a JavaScript function that seems to be functioning properly in all browsers except for IE and Safari. Strangely enough, my editor is flagging an error on line 4. The function's basic concept involves taking the ID of an HTML element ('element'), converting it to a string, creating an array containing all possible versions of 'element', removing 'element' from the array, and then executing another function using the filtered array and 'element' as variables. This is what I currently have:
function thisFunction(element){
var eStr = element.toString();
var eArray = ['element1', 'element2', 'element3'];
var fArray = eArray.filter(e => e !== eStr);
fArray.forEach(doThis);
function doThis(value){
// Perform operations with 'fArray' here...
return false;
doThis();
}
// Perform operations with 'element' here...
return false;
thisFunction();
}
The error appears to be related to the "var fArray" line, but I cannot seem to identify any issues. When attempting to activate the function by clicking the link, the error message received is "thisFunction is undefined", alongside the error on line 4.