case insensitive in javascript pattern code example
Example 1: javascript string search case insensitive
function stringContainsCaseInsensitive(search, subject){
return subject.toLowerCase().indexOf(search.toLowerCase()) !== -1;
}
stringContainsCaseInsensitive("red","We painted the room red.");//true
Example 2: snentence case capitalisation js
const string = "tHIS STRING'S CAPITALISATION WILL BE FIXED."
const string = string.charAt(0).toUpperCase() + string.slice(1)