perennial newbie question: how do i fix this "not a function" error:
exports.height = (input) => {
function height(node, height) {
if (node.left) {
if (height > maxHeight) {
maxHeight = height;
}
**height(node.left, height+1); // <-- Says "Not a function"**
}
}
var maxHeight = 0;
height( input, 0 ); // <--- This works fine.
return maxHeight;
}
says, TypeError: height is not a function
at height (BinarySearchTree.js:53:5)
Thanks! Nilesh
console.log(height)?exports.heightis referencing a different function. There are too many things namedheightin this code.