How function addFlower(arr) is called without using 'return' keyword inside the function?

What does return do, what would you say is missing that return would provide?

In Function section of the Javascript learning, I found that to call any function later on we have to use ‘return’ keyword inside the function. But in the snippet function is called and no ‘return’ keyword was necessary.

So I am confused. According to my learning from Function section of Javascript- the function should be writen as follows:
function addFlower(arr) {
return arr.push(‘lily’);

A function is not required to contain a return statement, no.
Reaching the end of it will exit the function and control goes back to the caller.

could You help me to understand why function could be called without using return keyword

Hi @dev6300938908

You seem to have asked this twice. :slight_smile:

Because I did not get the answer at the first time and I thought may be I could not explain what I was asking?
Because I am new in this forum, I want to ask You one question related to this.
Is there any option to edit my questions later on?

1 Like

There sure is.

If you click the pencil icon at the bottom of any of your posts, you can make changes at any point.



1 Like

Thank You for Your wonderful support.

1 Like

Furthermore, if something isn’t clear, its perfectly fine to ask a follow up question in the same topic.