Page 4 of 4

Posted: Sun Aug 12, 2007 1:39 pm
by Ollie Saunders
I wouldn't treat any language like another unless they are genuinely similar. JavaScript and PHP have some things in common but generally they are very different. I also think that coding standards are probably even more important in JavaScript because the language is more prone to abuse.

Posted: Sun Aug 12, 2007 1:47 pm
by Chris Corbyn
superdezign wrote:but one thing I noticed is that a few site said we should not use '//' style comments. Is this true?
Depends upon context. I would never do this:

Code: Select all

//Sends a redirect to $url
public function redirect($url) {
}
That wouldn't document with a documenting tool. It should be this:

Code: Select all

/**
 * Sends a redirect to $url.
 * @param string $url
 */
public function redirect($url) {
}
But I would definitely use //comments inside the body of a function where the flow of logic is.