Why am i getting a 'typeerror' when trying to call a function?

A 'TypeError' can occur in JavaScript if you're trying to call something that's not a function. This might happen if you've overwritten a function with a non-function type or have a typo. Example:

let greet = 'Hello';
greet();
Solution:

let greet = function() {
    console.log('Hello');
};
greet();
Make sure the variable you're trying to call as a function actually holds a function.

Beginner's Guide to JavaScript