Indexof Case Insensitive JavaScript

// First approach: convert all letters to either uppercase or lowercase
const favorite = "JavaScript";
const languages = "JavaScript, Python, and C#";
if (languages.toUpperCase().indexOf(favorite.toUpperCase()) !== -1) {
	console.log(`${favorite} is listed`);
} else {
  console.log(`${favorite} is not listed`);
}
// Alternatively, a regular expression can be used
const pattern = /Java/i; // i => ignore case flag
if(pattern.test(languages)) {
  console.log(`${favorite} is listed`);
} else {
console.log(`${favorite} is not listed`);
}
Wissam