Language - Comment

Card Puncher Data Processing


Comments are the code document.

They should explain why, not what. They can optionally explain how if what’s written is particularly confusing.



// This is a single-line comment 

/* But this 
           is a multiline

var a = /* It can also appears in the middle of an expression */ 42;


How to suppress comments with a regular expression

In javascript with the Replace function.

text = "// My beautiful comment\r\nmy beautiful code\r\n";
text = text.replace(/^[/]{2}[^\r\n]+[\r\n]+/mg, "");


  • The regexp pattern can be read as:
    • ^ - the start of the pattern
    • [/]{2}: two backslashes
    • [^\r\n]: All characters excepts the end of line \r\n. The ^ character is a negation in a class.
    • + is a quantifier meaning one or more

Discover More
Bash Liste Des Attaques Ovh
Bash - Comment

in bash Multiline In a non-interactive shell, or an interactive shell in which the interactive_comments...
CSS - Comments

CSS The comment syntax of CSS is the same than javascript. They: begin with the characters / end with the characters /. They may occur anywhere between tokens, and their contents have no influence...
Card Puncher Data Processing
Code - (Programming|Computer) Language

how the language is structured (grammar), how to name things you want to talk (vocabulary), and the customary and effective ways to say everyday things (usage). ...Grammarvocabularycommunity...B00B8V09HYEffective...
Card Puncher Data Processing
Code - Grammar / Syntax (Lexical)

This section regroups the entity of a computer language from a lexical point of view. It's the same as Parts of the speech for a natural language. Grammars are useful models when designing software...
Javascript - Comments

in Javascript Same rule than in CSS: See and double slash
Javascript - String

The in javascript. A string in JavaScript is encoded with the ucs-2 16-bit character set. An element of a JavaScript string is therefore a 16-bit code unit. code unitscode pointssurrogate pair Strings...
Lexical Analysis - (Token|Lexical unit|Lexeme|Symbol|Word)

A token is symbols of the vocabulary of the language. Each token is a single atomic unit of the language. The token syntax is typically a regular language, so a finite state automaton constructed from...

Share this page:
Follow us:
Task Runner