javascript-functions Flashcards
What is a function in JavaScript?
collections of instructions that can be repeated an infinite number of times
Describe the parts of a function definition.
function keyword function name parameters code block return statement
Describe the parts of a function call.
the function name and the arguments being passed into it inside the parentheses
When comparing them side-by-side, what are the differences between a function call and a function definition?
function definition has the parameter and the code block that it takes. the call takes the arguments that are passed into the function and code
What is the difference between a parameter and an argument?
parameter are placeholders in function definition and arguments are the ones that are passed into the function
Why are function parameters useful?
allows you to pass information into the function
What two effects does a return statement have on the behavior of a function?
returns the value of code and stops executing the code block