DEV Community

Discussion on: Daily Challenge #29 - Xs and Os

Collapse
 
kvharish profile image
K.V.Harish

My solution in js


const XO = (str) => {
  const countX = (`${str}`.match(/x/gi) || '').length,
    countO = (`${str}`.match(/o/gi) || '').length;
  return countX === countO;
};