Programs often work with text from users, files, or interfaces. Strings and input handling are core parts of everyday coding.
const firstName = "James";
const lastName = "Smith";
const fullName = `${firstName} ${lastName}`;
console.log(fullName.toUpperCase());
console.log(fullName.length);
User input can be missing, empty, or in the wrong format. It often needs trimming, validation, or conversion before it is safe to use.
const rawName = " Mia ";
const cleanedName = rawName.trim();
if (cleanedName.length > 0) {
console.log(`Hello, ${cleanedName}`);
}