I have a function that searches through a tree of folders and finds the selected folder's parent folder.
Here is the function.
getParentFolder: function (searchroot, childFolder) {
searchroot.subfolders.forEach(function (folder) {
if (folder.key == childFolder.key) {
return searchroot;
}
else {
if (folder.subfolders) {
return this.getParentFolder(folder, childFolder);
}
}
});
}
When I call this with this.getParentFolder(rootFolder, childFolder);
It simply just gives me: Uncaught TypeError: this.getParentFolder is not a function Why is this? In the same file I call other functions they work perfectly fine. This is the only function that I fail to be able to call. Is it because of the recursion?