SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript Comment Syntax

    Hi,

    I am working on a JavaScript file and it has one part of comment in this form:

    Code:
    /*! 
    * Comment goes here...
    */
    What's the use of the exclamation mark "!"?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,096
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    There exist so called minifiers for javascript, which compact .js files; strip comments, reduce whitepace, reduce length by taking short variable names, etc.
    Normally these minifiers strip out all comments, but when you add a ! to it they don't, so you can use to leave a copyright notice at the top of the file for example.
    Well, the one I know doesn't at least
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •