How is a comment categorized in JS?

Viewed 62

In JavaScript syntax, we know of stuff like:

  • +, =, ,, (...) being operators
  • var, let, function, for being keywords
  • 1, "string", being literals
  • 1+1 being an expression containing operators and literals and

  • var myVar = 1+1; being a statement containing keywords and expressions

How would you group // and /* ... */? I feel like it is an operator, but I don't see it in the Operator precedence table

I will soon give a training for beginners in JavaScript and I would like to be as rigorous as I can

2 Answers

Comment symbols, just as ;,,,{ and others, are lexical primitives and considered to occupy a high-level category, which is simply called Comments.

Related