Week 3- special delivery

Hello everyone so this is week 3 work that I’ve always had but totally forgot to put up lol



Blog questions

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 you put together code into packages. 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 “( )”.

function randomTest() {
//Calling a function

Join the Conversation

1 Comment

  1. Looking at your problem sets, things are going generally well with all functions except ‘climbing the mountain.’ You want to build the ‘spaces’ in an initial for loop then in a second for loop work through the phrase backwards. By having your spaces for loop inside the other for loop you made a lot of spaces! Looked fun though 😉

    Here’s a solution based on your code with the for loop for spaces completed before then using a second for loop.

    function mountain(phrase){
        let space = "";
        for(let j = 0; j < phrase.length; j++){
                    space += " ";
        for( i = phrase.length-1; i >= 0; i--){
            let stair = phrase[i];
                console.log(space.slice(phrase.length - i) + stair);
Leave a comment

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