Forgot username/password? Don't have an account?
Login with Facebook
Home » Courses » JavaScript 101 » Creating Javascript Comments
Subscribe for updates.
* New to us? log in with Facebook and get a free day pass

JavaScript 101

  1. Intro (03:59)
  2. The Script Tag (04:26)
  3. OOP and DOM (02:45)
  4. What are Variables? (01:37)
  5. Strings (10:39)
  6. Creating Javascript Comments (00:52)
  7. Numbers (09:29)
  8. Boolean (09:10)

Creating Javascript Comments

We'll get you familiar with some syntax first. In JavaScript you can comment a single line by putting two forward slashes in the start of that line like this:

// one line comment

Or if you have a lot more to say (multiple lines in a comment,) you can achieve that with ease by putting “/*” at the start and “*/” at the end like this:

/* This function requires two parameters: a string and a boolean.

It then returns a boolean that indicates if the user has a fat butt or not.

Call it like this for example: gotFatButt(userName, isFat); */

How can Comments help us?

Comments can be used to achieve discipline in coding. First you can comment out any code which you don’t want to run. If you delete your code there's always a chance you’ll regret it later when suddenly you figure out it's just what you need. Instead of deleting, just comment out blocks of code you think you might need again. (It's almost guaranteed that if you delete a block, you WILL need it later!)

Comments are a great way to describe your code and leave behind extra information for you and others that work with your code. A good program needs a good strategy and many times a few comments can help and improve overall understanding of your code. Comments are used as documentation many times in code as a way to share with others and yourself insight about your code. Many times we comment out debugging functions or other lines of code that we still want available but don't want them to run.

These tips may make your life easier in the future.

Got A Question?

'I love being Prime'

Have a question but don't want to ask it publicly? If you are a prime member just ask right here and we will get back to you within 48 hours. Not prime yet? no worries you can ask publicly below.

Act now while we have available seating

Our on line school is private, affordable and interactive with trainer support.
Act now save your seat before someone else takes yours.
Act now