Right here’s some obscure trivialities about JavaScript: it’s doubtless you’ll maybe maybe spend HTML feedback in JavaScript. Not reliable in
// below observation logs 1
console.log(1);
Featured Content Ads
add advertising hereRight here is fully a historical relic, and the utilization of this for anything else as opposed to experimentation is a Sinful Belief. The distinctive intent modified into once to effect it so as that browsers without JavaScript enhance would ignore script blocks that were surrounded with HTML feedback, in decision to treating them as text (browsers handle unknown parts as s). As such, HTML feedback inner JavaScript were disregarded. Such code blocks could maybe leer like this:
script>
script>
While there are no longer any browsers made within the past twenty years that designate the contents of script tags (even when JavaScript is disabled), this habits can’t be eliminated from browsers since some internet sites rely on this. Within the extinguish this habits modified into once added to the ECMAScript spec, as a legacy habits that will maybe maybe additionally honest aloof perfect be implemented in browser-like environments. I’m no longer sure why Node and Deno enhance this: perchance V8 doesn’t get any probability to disable this?
The spec enables for plenty of appealing comment habits. We are in a position to spend perfect works firstly up of a line. Unlike real HTML feedback, which would possibly maybe maybe additionally very well be block feedback, HTML-in-JS feedback are repeatedly line feedback.
Featured Content Ads
add advertising here// Logs 1
console.log(1); // Logs 1
Logs 3
console.log(3);
The motive that -->
is ideal allowed firstly up of a line is on fable of in some other case it would damage the “goes to” operator (decrement followed by increased than).
Some extra functional comment-linked trivialities I realized is that a shebang (#!
) at the starting of a file i
!–span>!–span>!–code>
Read More