A bug?


#1

This is the text it says:

  
    
      
        Tying it all together
      
      
        Why is the code organized like it is on lines 2-5?

The computer can understand the code without such spacing. But it makes editing a lot easier and is best practice.

Do I have to put a semi-colon at the end of each line of code in the reusable block? And at the end of the entire function?

Yes. At the end of each line of code (within the { }) and after the entire function (after the { }),
please put a semi-colon. The semi-colon acts like a period in a
sentence. It helps the computer know where there are stopping points in
the code.

      
    
    
      
        Instructions

A big part of programming is debugging. That just means
figuring out what the heck went wrong with your code. Why didn't it run?

  1. Look at line 9. It has many syntax errors. See how lack of spacing makes debugging hard?
  2. Fix the function on line 9. Make sure the syntax is right. Make sure it looks nice.
  3. Call the greeting function once it is fixed! Don't forget to pass in a specific name.

And this is what in the editor sits by default:

// Nicely written function:
var calculate = function (number) {
var val = number * 10;
console.log(val);
};

// Badly written function with syntax errors!

greeting var func{name}(console.log(name)))}

The var calculate and var val haven't got anything to do with this exercise?


#2

Hi this part like the comment says

// Badly written function with syntax errors!

greeting var func{name}(console.log(name)))}

you it's badly write you shoudl write it well


#3

But the other variables at the beginning doesn't have to do anything with the question....?


#4

YEs the other function is here to show you how the a function should be and and that may help to write the other funciton that has been written badly.


#5

Ye it confused me because it doesn't say that that was an example so it got me confused :sweat_smile:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.