- What is a function? Give an example of a daily task which could be abstracted into a function.
- In your console, create a named function and an anonymous function.
- Create a function called
myFunctionName. What doesmyFunctionNamereturn? What doesmyFunctionName()return? - What does a function return by default?
- Create a function which returns "You are the world's greatest" when invoked.
- What part is the function signature of the following function:
function calculateChanges(oldValue, newValue) { };? - Given the function:
function makeACake(ingredients, servings, isPerishable)- If I invoke the function like this
makeACake(45, 12, 98), what will be the value ofingredients,servings, andisPerishablein the function body? - What about this:
makeACake("sugar, egg, flower", 12)? - What about this:
makeACake(true, 3)?
- If I invoke the function like this
- Create a function with one parameter. How would you access the argument within the function without using the parameter name?