Skip to content

Instantly share code, notes, and snippets.

@birkir
Created December 4, 2014 10:27
Show Gist options
  • Save birkir/37d7356842843e9b6cb1 to your computer and use it in GitHub Desktop.
Save birkir/37d7356842843e9b6cb1 to your computer and use it in GitHub Desktop.
Jóladagatal 4/24 - Spegilorð
// HTTP 200 www.foo.is /ord
// paste in console
var words = document.body.children[0].innerText.toLowerCase().split("\n"),
count = 0;
for (var i = 0; i < words.length; i++) {
for (var p = Math.floor(words[i].length / 2); p >= 0; p--) {
if (words[i][p] !== words[i][words[i].length - p - 1]) break;
if (p === 0) count++;
}
}
console.log(count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment