What is function call? | Codecademy (2024)

Skip to ContentMini Arrow Down Icon

This forum is now read-only. Please use our new forums! Go to forums

points

What is function call? | Codecademy (1)

Submitted by

swali1

over 8 years

how do you call a function in javascript.what is the syntax and a example please.

thanks

Answer 557acf299113cbe852000022

1

vote

Permalink

You call the function by typing its name and putting a value in parentheses. This value is sent to the function’s parameter.

e.g.

var firstFunction = function(firstParameter){console.log("Print the " + firstParameter;}firstFunction("string as it's shown.");

In this example the function’s name is firstFunctionThe parameter’s name is firstParameter

We call the function firstFunction(“string as it’s shown.”);

This sends the string “string as it’s shown.” to the function and the parameter firstParameter takes it’s value.

Now the code inside the function actual reads

“Print the “ + “string as it’s shown.”;

Does that make sense?

points

What is function call? | Codecademy (2)

over 8 years

4 comments

What is function call? | Codecademy (3) swali1

over 8 years

yes..Thanks.only the last bit got ehh…“Print the “ + “string as it’s shown.”; was a little tricky..sinmce the elemts in the example you gave were first parameter ,first function.i mean not easy to understand elements.Anyways good example.Thanks

What is function call? | Codecademy (4) swali1

over 8 years

why is function not called before the variable declaration?

What is function call? | Codecademy (5) swali1

over 8 years

Primitive parameters (such as a number) are passed to functions by value; the value is passed to the function, but if the function changes the value of the parameter, this change is not reflected globally or in the calling function.

What is function call? | Codecademy (6) swali1

over 8 years

what does the above sentence mean?

What is function call? | Codecademy (2024)
Top Articles
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 6197

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.