Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vitae
facilisis justo. Aenean non sem at risus posuere placerat, sed luctus
libero. Curabitur blandit tempus porttitor; the small details often shape
the way a larger system behaves.
This example turns a short phrase into a URL-safe slug. The loop keeps the
transformation explicit and easy to inspect.
function slugify(value) {
return value
.normalize("NFKD")
.toLowerCase()
.trim()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-|-$/g, "");
}
slugify("Lorem Ipsum & Strings");
// => "lorem-ipsum-strings"