const originalString = "Hello, World!";
const lowercaseStr = originalString.toLowerCase();

console.log(lowercaseStr); // Output: "hello, world!"

/* 👇 The original string remains unchanged. */
console.log(originalString); // Output: "Hello, World!"
str.toLowerCase();
const number = 42; // A number, not a string

try {
    let result = number.toLowerCase(); // A TypeError occurs here
    console.log(result);
} catch (error) {
    console.error(error); // TypeError: number.toLowerCase is not a function
}
const str1 = "apple";
const str2 = "APPLE";

if (str1.toLowerCase() === str2.toLowerCase()) {
    console.log("The two strings are the same.");
} else {
    console.log("The two strings are different.");
}

// Output: "The two strings are the same."
const keywords = ["JavaScript", "HTML", "CSS"];
const userInput = "javascript";

const matchingKeywords = keywords.filter(keyword => {
    return keyword.toLowerCase() === userInput.toLowerCase();
});

console.log(matchingKeywords); // Output: ["JavaScript"]
const originalFileName = "MyDocument.txt";
const normalizedFileName = originalFileName.toLowerCase();

console.log(normalizedFileName); // Output: "mydocument.txt"
const data = [
    {name: "Hello"},
    {name: "HelloWorld"},
    {name: "hello"}
];

const normalizedData = data.map(item => {
    return {
        name: item.name.toLowerCase()
    };
});

console.log(normalizedData);
/*
Output:
    [
        {name: "hello"},
        {name: "helloworld"},
        {name: "hello"}
    ]
*/