Last active
August 29, 2015 14:15
-
-
Save devcem/60a11c8c1feb4bcbf31f to your computer and use it in GitHub Desktop.
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
<script> | |
function similarity(val){ | |
var output = 0; | |
for(i=0;i<val.length;i++){ | |
output+=val.charCodeAt(0); | |
} | |
return parseInt(output/val.length); | |
} | |
console.log(similarity("kahve")); | |
console.log(similarity("kahveler")); | |
console.log(similarity("kahvem")); | |
console.log(similarity("çaylar")); | |
if(similarity("kahve")==similarity("kahveler")){ | |
console.log('"kahve" and "kahveler" words are same'); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment