Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active May 15, 2017 21:42
Show Gist options
  • Save rogerwschmidt/5da7e85d873f82c1775906a02a083597 to your computer and use it in GitHub Desktop.
Save rogerwschmidt/5da7e85d873f82c1775906a02a083597 to your computer and use it in GitHub Desktop.

Functions

Objectives

Describe the anatomy of a function definition.

Turn and speak with your neighbor, define and describe each of the parts of the following function

function createGreeting(name){
  var greeting = 'Hello ' + name + '!';
  return greeting;
}

Articulate the difference between defining and invoking a function.

What is the difference between a function definition and a function invokation

Create functions with named parameters, and pass in arguments when calling them.

Create a function with 2 parameters that returns the sum of the parameters. Then invoke the function with the arguments 
4 and 5 as numbers.

Control a for loop inside a function using an argument to determine the looping condition.

Create a function that takes a number as a parameter, print the string "I'm in a function" as many times as the number
specifies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment