There are two kinds of comment blocks supported by JavaScript. They each have a different kind of delimiter.
Single-line comments commence with a pair of slash characters (//) and stop at the end of the current line.
Multi-line comments start with a slash-asterisk (/*) and finish at the first following asterisk-slash (*/). This means you cannot nest multiple line comment blocks inside one another. The disadvantage with that is that it is common practice in some languages to comment out sections of code by marking the start and end of the inactive sections as a multi-line comment block. This won't work if there are any multi-line comment blocks anywhere in this inactive block. A better technique, although slightly more cumbersome is to use single line comments (//) to 'switch-off' the lines of code you want to deactivate. Thus:
//a = 1000; //b = 2000; //c = 3000;
Prev | Home | Next |
Comment | Up | COMMENT object |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |