Skip to content

Instantly share code, notes, and snippets.

@evolutionxbox
Last active April 6, 2016 13:26
Show Gist options
  • Save evolutionxbox/9884a06be503fa154046 to your computer and use it in GitHub Desktop.
Save evolutionxbox/9884a06be503fa154046 to your computer and use it in GitHub Desktop.
function ClosedBracketWord(w='w') {
return !w[19] && w.split('').every((l, i) => 122-(l.charCodeAt()-97) === w.charCodeAt(w.length-1-i));
}
ClosedBracketWord('abiryz'); // true
ClosedBracketWord('abixyz'); // false
ClosedBracketWord('ABCXYZ'); // false
ClosedBracketWord(''); // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment