taesik

has the same amount of 'x's and 'o's. 본문

functions and trick/typescript_javascript

has the same amount of 'x's and 'o's.

taesikk 2022. 1. 23. 16:43
function XO(str) {
  let x = str.match(/x/gi);
  let o = str.match(/o/gi);
  return (x && x.length) === (o && o.length);
}