JavaScript Comments In Hindi

📔 : Java Script 🔗

Comments program में line of code होता है जो कि execute नहीं होता है , जिससे कि जब Again हम उस program पर काम करे तो हर step हमें समझ आ सके कि हमने इसमें किया क्या था।

JavaScript में Comments दो तरह के होते हैं -

  1. Single Line Comments
  2. Multi line Comments

JavaScript Single Line Comments

JavaScript में Single Line Comments // से start करते हैं।

Another File : comments.html

Copy Fullscreen Close Fullscreen Run
<!DOCTYPE html >
<html>
  <head>
    <meta charset="utf-8">
    <title>Js Syntax</title>
  </head>
  <body>
    <script>
      document.write('This is single line comment');
      // this is single line comment
    </script>
  </body>
</html>
Output
This is single line comment

JavaScript Multi Line Comments

multi line comment लिखने के लिए हमें /* से start करते हैं और */ से end करते है।

See Example :

Another File : comments2.html

Copy Fullscreen Close Fullscreen Run
<!DOCTYPE html >
<html>
  <head>
    <meta charset="utf-8">
    <title>Js Syntax</title>
  </head>
  <body>
    <script>
      document.write('This is multi line comment');
      /* this is 
          multi 
        line 
       comment
      */
    </script>
  </body>
</html>
Output
This is multi line comment

JavaScript Advantages Of Using Comments

  • किसी भी project पर काम करने के बाद हमें जरूरत के हिसाब से समय के साथ उसमे changes करने पढ़ ही जाते हैं तो जब हम update करें तो हमें proper पता चले कि हमने किया क्या था।

  • या जब कोई दूसरा programmer हमारे द्वारा develop किये गए project को देखे या update करे तो उसे भी पता चले।

  • Comment लिखना आपकी Coding Standardization को भी बताता है।

  • कमेंट लिखने से Coding Readability भी बढ़ती है।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers