Created
December 4, 2014 10:27
-
-
Save birkir/37d7356842843e9b6cb1 to your computer and use it in GitHub Desktop.
Jóladagatal 4/24 - Spegilorð
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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