タイトルが雑。

やりたいことは table の今日の曜日と同じ th の色を変えることである。

const today = new Date();

[...document.querySelectorAll('th')]
    .filter((th) => th.textContent === ["日", "月", "火", "水", "木", "金", "土"][today.getDay()])
    .forEach((th) => {
        th.style.backgroundColor = "#8fd19e";
    });

今日の曜日を取得する

 ["日", "月", "火", "水", "木", "金", "土"][today.getDay()];

これで取得が可能。

文字列マッチング

th.textContent === "日";

String.prototype.includes() でもいいが、完全マッチで問題ないので === にしている。

背景色を変える

th.style.backgroundColor = "#8fd19e";

該当する th を #8fd19e ■ な色に変更している。

以上がおおよそやっていることである。