Profile photo of Travis Horn Travis Horn

Just for fun: The LOL ID

2019-02-14
Just for fun: The LOL ID

What type of unique identifier should you use for your next data-backed project? Incremental integers? UUIDs? A URL-friendly short ID? I present: the LOL ID.

"lxxxxxxxxl".replace(/x/g, () => (Math.random() > 0.5 ? "l" : "o"));

Check out the live demonstration on CodePen.

This code generates a random ID that starts and ends with “l” and contain eight random “o”s or “l”s.

Some random LOL IDs generated with this code:

  • lloollooll
  • lolollloll
  • lololloool
  • loolololll
  • loloooolol

Disclaimer

Don’t actually use this code for anything, ever. The IDs are not guaranteed to be unique by a looong shot.

Here are some more articles you might like: