Welcome! Log In Create A New Profile

Advanced

JavaScript Comments

Posted by Valeske- 77927052 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
JavaScript Comments
April 24, 2013 01:49PM
Hi,

On page 7 of the JavaScript section is says that comments in javascript for single lines can be made by using: //

If though you wanted to comment out multiple lines below each other without wanting to type '//' after each line, all you need to do is:

Add /* at the start of the first line you want to comment out and */ at the final line you want to comment out.

Example:

Language: Javascript
/* function showMsg() { window.status = msg msg = msg.substring(1,msg.length) + msg.substring(0,1) scrollmsgID = setTimeout("showMsg()",150) // Inserted to have scrolling message stop when mouse pointer over rhino image. } */

instead off:

Language: Javascript
// function showMsg() // { // window.status = msg // msg = msg.substring(1,msg.length) + msg.substring(0,1) // scrollmsgID = setTimeout("showMsg()",150) // Inserted to have scrolling message stop when mouse pointer over rhino image. // }
avatar
Mac
Re: JavaScript Comments
April 24, 2013 04:56PM
Yes, your choice. It depends how much you want to comment out. I sometimes use // although I can use /*. Habits.
Re: JavaScript Comments
April 24, 2013 08:31PM
Sorry, only registered users may post in this forum.

Click here to login