Do not use eval()first of all.
function myUIEvent() {
var iCheckFcn = isInFavorites;
var itemSrc = ui.item.find("img").attr("src");
if (iCheckFcn(itemSrc)) { alert("it a favorite"); }
}
Functions are objects, and you can assign a function reference to any variable. Then you can use this link to call the function.
source
share