filmov
tv
Javascript project for Beginners - Slugify, from no case to Spinal Case
Показать описание
In this video, I am going to use vanilla Javascript to build a simple script that you'll be using very frequently when building your next application, website, or project. This script takes an argument, usually a string, and converts it to Spinal Case, actually creating a slug. I can see 2 questions arise from you:
1. What is Spinal Case?
2. What is a slug?
1. Spinal Case is a type of string format where all the spaces, symbols and non-alphabetic characters of a string are converted into hyphens. Something like "old the door" becomes "old-the-door". It is frequently used by developers to do all sorts of things. From naming elements in HTML, to create unique identifiers for records in databases;
2. A slug is a string formatted in spinal case that replaces a piece of text., generally a title, or the name of an article, to make it URL friendly. URLs are very sensitive, there are many things they like, in that case, they are gentle, kind, and helpful. On the other hand, there are also think they don't like: symbols, hash, commas, question marks, colons, semicolons. These things turn URLs into a dream-killing machine to developers. They are merciless and throw errors and exceptions left and right. This is the reason we, developers need to only feed the URLs with something good, something they like so that they rest peacefully and harmlessly.
A slufìg is an optimal solution that links the URL, so the front end of a website, and its back end, namely the database. As a matter of fact, slugs are used and should be used as unique identifiers for objects, records, people, users, places, etc. What the ID is meant for in a database, a slug is for URLs.
From this brief explanation you should already be able to see why they are so important, but above all, why you are going to see yourself coding something like this more often than you'd want. You'll find that creating slugs is super common in everyday apps, websites, and software.
This is the second project in the milestone project series where I explore what it means to be a self-taught programmer, and I share some of my projects from when I had just started coded to full-fledged applications to put on your resume.
Keep checking these projects, they will be needed,
BeGeos
1. What is Spinal Case?
2. What is a slug?
1. Spinal Case is a type of string format where all the spaces, symbols and non-alphabetic characters of a string are converted into hyphens. Something like "old the door" becomes "old-the-door". It is frequently used by developers to do all sorts of things. From naming elements in HTML, to create unique identifiers for records in databases;
2. A slug is a string formatted in spinal case that replaces a piece of text., generally a title, or the name of an article, to make it URL friendly. URLs are very sensitive, there are many things they like, in that case, they are gentle, kind, and helpful. On the other hand, there are also think they don't like: symbols, hash, commas, question marks, colons, semicolons. These things turn URLs into a dream-killing machine to developers. They are merciless and throw errors and exceptions left and right. This is the reason we, developers need to only feed the URLs with something good, something they like so that they rest peacefully and harmlessly.
A slufìg is an optimal solution that links the URL, so the front end of a website, and its back end, namely the database. As a matter of fact, slugs are used and should be used as unique identifiers for objects, records, people, users, places, etc. What the ID is meant for in a database, a slug is for URLs.
From this brief explanation you should already be able to see why they are so important, but above all, why you are going to see yourself coding something like this more often than you'd want. You'll find that creating slugs is super common in everyday apps, websites, and software.
This is the second project in the milestone project series where I explore what it means to be a self-taught programmer, and I share some of my projects from when I had just started coded to full-fledged applications to put on your resume.
Keep checking these projects, they will be needed,
BeGeos
Комментарии