Thursday 12 January 2017

trying to create a palindrome checker

Here's my code:var fs = require('fs'); var check = require("./palin")var words; var revWords;function checkFile(callback){ fs.readFile("eowl.txt", function(err, data){ if(err){ return console.error(err); } words = data.toString(); callback(); }) }function palindrome(){ revWords = words.split("").reverse().join("") if(revWords === words){ console.log(revWords); } }checkFile(palindrome);any hints would be greatly appreciated!

Submitted January 12, 2017 at 02:24PM by Chigurhshairdresser

No comments:

Post a Comment