Categories
JavaScript Answers

How to call a JavaScript function from console?

Spread the love

Sometimes, we want to call a JavaScript function from console.

In this article, we’ll look at how to call a JavaScript function from console.

How to call a JavaScript function from console?

To call a JavaScript function from console, we just type in the code to define the function and call it.

For instance, we type

const myFunction = () => {
  alert("doing something!");
};
myFunction();

into the console to define the myFunction function and call it.

Then we should see an alert box that shows ‘doing something!’.

Conclusion

To call a JavaScript function from console, we just type in the code to define the function and call it.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.