Skip to content
Advertisement

How can I call a function that is defined outside of a class from inside a class

So I haven’t really tried much, as I’m new to OOP, all I tried is to make a function for setting the progress bar for an action. When I call it from inside the class it says the function doesn’t exist. How can I get around this? Thanks!

If I don’t call the function in a class the progress bars works fine.

JavaScript

ERRORS

JavaScript

Advertisement

Answer

You had some typos but sure you can, take a look:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement