Javascript comments on same line as code: yes or no? [closed]

Javascript has 2 types of comments, and both work in all browsers.

  • // comment denotes 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.

Browse More Popular Posts

Leave a Comment