So here’s some code I’ve written in Javascript:
var panRate = 120; //Max speed of the camera
var panAccelerate = 0.01; //Amount speed increases each frame
var panDecelerate = 1.05; //Amount speed is divided by each frame
Is that kosher, putting the comments on the same line as the code? Firefox and Chrome don’t seem to be having any problems with it, but does that have the potential to break certain browsers?
Javascript has 2 types of comments, and both work in all browsers.
// commentdenotes an “inline” comment. Any characters on that line after the//are a comment./* comment */are “block” comments. Any characters withing the/*and*/are a comment, and can span multiple lines.Both are valid in all javascript implementations, universally.
Style is the only real concern here. And that is a far more subjective question.