Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and be case insensitive. The string can contain any char.
function XO(str) {
let x = 0;
let o = 0;
for (let i = 0; i < str.length; i++) {
if (str[i].toLowerCase() === "x") {
x++;
} else if (str[i].toLowerCase() === "o") {
o++;
}
}
return x === o;
}function XO(str) {
return str.toLowerCase().split('x').length === str.toLowerCase().split('o').length;
}