Week 3 – Blog Post

Describe the difference between declaring a function and calling a function. Give an example in a code snippet using Enlighter. Have you example use an argument.

Declaring a function tells the computer that this block of code should be executed whenever this function name is called. Its basically labeling a section of your code, usually set within curly brackets. Calling a function tells the computer, “Hey execute that code I labeled.”


//Below is an example of a function declaration
// function code goes here
//Below is an example of calling a function.

Aaaaaaaaaaaaaaaaaaaaaaaand here’s this weeks work.

Join the Conversation

1 Comment

  1. A solid description of the difference between declaring and calling a function. And your functions are looking good as well. One note to consider in the randomColor() function is spacing that is preferred with an rgb color value. Your function returns “rgb(169,98,219)” values and a space after each comma is desired – “rgb(169, 98, 219)”. I like to use the template literal syntax over string concatenation which is often easier to read to me.

    `rgb(${r}, ${g}, ${b})`

Leave a comment

Your email address will not be published. Required fields are marked *