Press the Doorbell === Invoke the Function

Mar 27 · 2 min read

If you’re new to JavaScript, you may have had a few issues when writing functions. You may have wondered ‘why when you write a function you are not seeing anything displayed in the console?’ unless of course there are errors. With this in mind, we will walk through a simple example to hopefully clarify some foggy doubts.

At first glance the code for the function looks right so why aren’t we seeing anything in the console?

We can see we have a function called ‘ringDoorbell.’ Now picture that you have a doorbell in your house installed yes; but can you hear the doorbell sound if no one presses it? Of course not! In this example, we are simulating that same scenario.

Some functions we create do not get executed and thus we are not able to see anything displayed on the console. This is because they are not active until we invoke the ‘call’ command. Therefore, we need to invoke the function by ‘calling’ the function name and adding the parenthesis in the end; like this:


See image below

Another note, remember that in coding JavaScript everything you type is case sensitive thus when you invoke the function, make sure the characters typed in match.

Thank you for reading

“Opportunity may knock only once but temptation leans on the doorbell”


Written by


Web Developer