ต่อไปนี้คือ single line comment ใน JavaScript ข้อความระหว่าง // และท้ายบรรทัด จะถูกจัดว่าเป็นคอมเมนต์และถูก JavaScript ไม่สนใจ
// This is a comment. It is similar to comments in C++
ตัวอย่างต่อไปนี้แสดงวิธีใช้ single line comments ใน JavaScript
<script>
<!--
// This is a comment. It is similar to comments in C++
//-->
</script>