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

ความแตกต่างระหว่าง single-line และ multi-line comments ใน JavaScript


Single Line comment

ต่อไปนี้คือ single line comment ใน JavaScript ข้อความระหว่าง // และท้ายบรรทัด จะถูกจัดว่าเป็นคอมเมนต์และถูก JavaScript ไม่สนใจ

// This is a comment. It is similar to comments in C++

Multi-Line comment

ต่อไปนี้คือ multi-line comment ใน JavaScript

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