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

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

/* 👇 元の文字列は変更されません。 */
console.log(originalString); // 出力: "Hello, World!"
str.toLowerCase();
const number = 42; // 文字列ではない数値データ型

try {
    let result = number.toLowerCase(); // この部分でTypeErrorが発生
    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("2つの文字列は同じです。");
} else {
    console.log("2つの文字列は異なります。");
}

// 出力: "2つの文字列は同じです。"
const keywords = ["JavaScript", "HTML", "CSS"];
const userInput = "javascript";

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

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

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

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

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