Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7668073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:15:56+00:00 2026-05-31T15:15:56+00:00

Possible Duplicate: Why does this Javascript code inside a non-Javascript browser have extra commenting?

  • 0

Possible Duplicate:
Why does this Javascript code inside a non-Javascript browser have extra commenting?

Sometimes I’m seeing some Javascript which begins with <!-- and ends with //-->.

I wonder what is the use of such line? As far as I know, <!-- means comments line. But that does not seem to be the case, as the script will still work even with such line. And it also works if the line is removed.

Here is one short example:

<script language='JavaScript' type='text/javascript'>
<!--
    function changelang(id) {
    document.location.href='index.php&lch=1&lang=' + id }
//-->
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:15:57+00:00Added an answer on May 31, 2026 at 3:15 pm

    It used to be used for old browsers which did not understand script tags and would render their contents nodes as text, which of course was undesirable.

    This may make more sense when you think of contents of canvas, audio, noscript elements (the latter of which is treated special today, but imagine back in the old days where the browser did not know what the noscript element was).

    In this day and age, it is not required.

    Douglas Crockford recommends against their use.

    Do not use the <!-- //--> hack with scripts. It was intended to
    prevent scripts from showing up as text on the first generation
    browsers Netscape 1 and Mosaic. It has not been necessary for many
    years. <!-- //--> is supposed to signal an HTML comment. Comments
    should be ignored, not compiled and executed. Also, HTML comments are
    not to include --, so a script that decrements has an HTML error.

    Source.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What does this “(function(){});”, a function inside brackets, mean in javascript? javascript
Possible Duplicate: What does this “(function(){});”, a function inside brackets, mean in javascript ?
Possible Duplicate: What does this mean? (function (x,y)){…}){a,b); in JavaScript I have the following
Possible Duplicate: Python list append behavior Why does this code: x = [[]]*3 x[0].append('a')
Possible Duplicate: What do parentheses surrounding a JavaScript object/function/class declaration mean? What does this
Possible Duplicate: Question on this JavaScript Syntax (“What Does This Do?”) What is the
Possible Duplicate: Decode obfuscated JavaScript Question: I have the following javascript code: var _0xe91d=[\x28\x35\x28\x24\x29\x7B\x24\x2E\x32\x77\x2E
Possible Duplicate: What does this JavaScript/jQuery syntax mean? I specifically mean when you do
Possible Duplicate: Question on this JavaScript Syntax (“What Does This Do?”) in this article
Possible Duplicate: What does this mean? (function (x,y)){…}){a,b); in JavaScript Please anyone explain and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.