Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

ความแตกต่างระหว่างคอมเมนต์ /*...*/ และ /**...*/ ใน JavaScript


/*...*/ และ /**...*/ เป็น multi-line comments ต่อไปนี้คือ multi line comment ใน JavaScript

/*  
    * This is a multiline comment in JavaScript 
    * It is very similar to comments in C Programming 
*/

ตัวอย่างต่อไปนี้แสดงวิธีใช้ multi-line comments ใน JavaScript

<script> 
    <!-- 
        /* 
            * This is a multiline comment in JavaScript 
            * It is very similar to comments in C Programming 
        */ 
    //--> 
</script>

คอมเมนต์ /** */ ใช้สำหรับ PHPDocumentator ซึ่งใช้สร้างเอกสารอัตโนมัติ