JavaScript Internals (521 Qs)•Part 3: DOM, Event Flow, Timers & Browser APIs (104 - 173)
Is the !-- notation represents a special operator
No,that's not a special operator. But it is a combination of 2 standard operators one after the other,
- A logical not (!)
- A prefix decrement (--)
At first, the value decremented by one and then tested to see if it is equal to zero or not for determining the truthy/falsy value.
Practical Code Example
javascript
// '<!--' is NOT a special operator. It is legacy HTML comment syntax:
// In browser script tags, it is parsed identically to a single line '//' comment:
<!-- console.log('This line is commented out in browsers');
console.log('This line executes');