---
title: Idle JavaScript Observations
author: George Mandis <george@mand.is>
date: 2021-06-04
description: Further adventures in JavaScript
tags: post, post, useless, javascript
---

There are lots of blogs that post useful tips and observations about programming in JavaScript and other languages.

This is not one of them.

Sometimes I like to look at the `label` documentation for JavaScript on MDN and ponder unusual ways I can use it:

```
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
```

The way [Svelte makes use of the label syntax](https://svelte.dev/docs#3_$_marks_a_statement_as_reactive) is actually kind of interesting. When I did a deep-dive into that framework last year this jumped out.

But a deep-dive into labels and scoping might actually be useful. This post is just to let you know that this is valid JavaScript:

```
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
```

In fact, copying-and-pasting just about any URL is probably valid JavaScript. 

Why is this?

- The http(s) protcol gets interpreted as the aforementioned `label`.
- The // immediately following the label starts a comment.

The lowdown: you can copy and paste just about any website directly into your JavaScript code without modification and it won't break anything.

Is this useful? Not really. Just a funny observation I learned the hard way, when I forgot to copy out the reference to some documentation elsewhere in my code.


&rarr; **Filed under**:  [Useless JavaScript](/useless-javascript).