I am trying to call a function in my JavaScript code, but I keep getting the error “TypeError: undefined is not a function”. Here is my code:
function greet(name) {
return "Hello, " + name + "!";
}
console.log(greet("Alice"));
console.log(sayGoodbye("Bob")); // This line causes the error
function sayGoodbye(name) {
return "Goodbye, " + name + "!";
}
Correct the code above correctly
New contributor
E41222849 Andhung Gusti Wulang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.