[WEEK #3] – 10 JavaScript Basics – Functions + Problem Sets + Blog Question


Hey guys. This week was pretty light on me because I know what functions are and I have worked with these before in different languages. The only thing that stumped me up was the random-color problem set. I had trouble with how to properly generate a random number between 0 and 255 that also included both the numbers. I believe I did it correctly but I am not sure. Overall this was a light week (work wise).

Tutorials


Problem Sets


Blog Question


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.

Functions let us wrap code into reusable packages. They are one of the building blocks of JavaScript. When declaring a function, you define a block of code and give it a name. If you just have a declaration inside of the js file, the JavaScript file will not run anything. Essentially you are just registering the function. When calling a function you are basically giving an order to the function, that is telling it to execute. To call a function you have to write the function name with ( ).

//Declaring a function
function randomTest() {
    console.log("Hey! I am declaring a function");
}

//Calling a function
randomTest();
randomTest();
randomTest();

Join the Conversation

1 Comment

Leave a comment

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

css.php