In JavaScript, comments are used to explain code, make notes, or prevent certain parts from running. Comments are ignored by the browser and do not affect how the code works.
JavaScript supports two types of comments:
//
/*
and end with */
// This is a single-line comment let name = "John"; // This is an inline comment /* This is a multi-line comment. It can span multiple lines. */ let age = 30;
Click the button to see how comments are ignored by JavaScript:
//
for single lines and /* */
for blocks.
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!