May 29, 2021 Article blog
Comments are important in project development, and reasonable code annotations facilitate later modification and maintenance of the project and make it easier for co-workers to understand the functionality of the piece of code. W hen the browser is running, the comments are not read. Today we're going to learn how JavaScript adds comments.
Single-line comment: In JavaScript, a single-line comment is represented by
//
(double forward slash).
as follows:
//这是一个单行注释
Multi-line comments: Multi-line comments in JavaScript
*/
included in
/*
and
/**/
slash with asterisk).
as follows:
/*这是一个注释*/
Or as follows:
/*
*w3cschool-编程狮
*随时随地学编程
*/
That's all JavaScript says about how to add comments.