Skip to content

Instantly share code, notes, and snippets.

@WDever
Last active December 25, 2018 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WDever/8322e18895213367731ada512ead20af to your computer and use it in GitHub Desktop.
Save WDever/8322e18895213367731ada512ead20af to your computer and use it in GitHub Desktop.
const solution = (s) => {
let pEa = 0;
let yEa = 0;
pEa = (s.match(/p/gi) || []).length;
yEa = (s.match(/y/gi) || []).length;
console.log(pEa, yEa);
if(pEa === yEa) {
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment