This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes double slash Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "double slash" Watch "double slash" New topic
Author

double slash

Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 90

Howdy folks,

This is sort of strange, might be a silly question or might even turn out to be nothing. But does anyone know what the double slashes between a javascript declaration are for ?

To make it more confusing, some of the declarations also have "var" which follows the double slash


My first guess was that it might be commenting out the entire script. But no ! It runs just fine.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62126
    
  68

There is no reason for any of that to be there. It's complete nonsense. The browsers ignore any content in script tags that use the src attribute.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dhaval J. Patel
Ranch Hand

Joined: Mar 10, 2011
Posts: 90

Thanks Bear. I just joined this company and was browsing code and this thing was bugging me haha. Anyways, thanks for the quick answer..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62126
    
  68

I'd be very cautious about what else you might find in such code!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: double slash