Comments Javascript supports two types of comments. Double-slashes (//) tell javascript to ignore everything to the end of the line. You will see them used most often to describe what is happening on a particular line. var x=5; // Everything from the // to end of line is ignored(*) var thingamajig=123.45; // 2 times the price of a whatsit. "Blockquotes" begin a comment block with a slash-asterisk (/*) and Javascript will ignore everything from the start of the comment block until it encounters an asterisk-slash (*/). Blockquotes are useful for temporally disabling large areas of code, or describing the purpose of a function, or detailing the purpose and providing credits for the script itself. function whirlymajig(jabberwocky) { /* Here we take the jabberwocky and insert it in the gire-gimble, taking great care to observe the ipsum lorum! For bor-rath-outgrabe! We really should patent this! */ return (jabberwocky*2); } You should note that while comments are usef
Comments
Post a Comment